eth: enforce signing hashes using eth_sign instead of arbitrary data

This commit is contained in:
Jeffrey Wilcke 2016-04-01 00:43:14 +02:00
parent 10d3466c93
commit 916fe11241
1 changed files with 4 additions and 4 deletions

View File

@ -1102,10 +1102,10 @@ func (s *PublicTransactionPoolAPI) SendRawTransaction(encodedTx string) (string,
return tx.Hash().Hex(), nil
}
// Sign will sign the given data string with the given address. The account corresponding with the address needs to
// be unlocked.
func (s *PublicTransactionPoolAPI) Sign(address common.Address, data string) (string, error) {
signature, error := s.am.Sign(accounts.Account{Address: address}, common.HexToHash(data).Bytes())
// Sign signs the given hash using the key that matches the address. The key must be unlocked in order to sign the
// hash.
func (s *PublicTransactionPoolAPI) Sign(address common.Address, hash common.Hash) (string, error) {
signature, error := s.am.Sign(accounts.Account{Address: address}, hash[:])
return common.ToHex(signature), error
}