diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-04-01 19:42:48 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-04-01 19:42:48 +0800 |
commit | be44651523bc44bff6a31064eb3917e4682eb866 (patch) | |
tree | 20bbb57100d4f7563cf83f4c56be099fd8804cd9 /eth/api.go | |
parent | c58079461bafe508bea9233e2b81852df5188f57 (diff) | |
parent | 916fe112417cae924557646ba9afeb6b517e11b4 (diff) | |
download | go-tangerine-be44651523bc44bff6a31064eb3917e4682eb866.tar go-tangerine-be44651523bc44bff6a31064eb3917e4682eb866.tar.gz go-tangerine-be44651523bc44bff6a31064eb3917e4682eb866.tar.bz2 go-tangerine-be44651523bc44bff6a31064eb3917e4682eb866.tar.lz go-tangerine-be44651523bc44bff6a31064eb3917e4682eb866.tar.xz go-tangerine-be44651523bc44bff6a31064eb3917e4682eb866.tar.zst go-tangerine-be44651523bc44bff6a31064eb3917e4682eb866.zip |
Merge pull request #2402 from obscuren/eth-sign-fix
eth: enforce signing hashes using eth_sign instead of arbitrary data
Diffstat (limited to 'eth/api.go')
-rw-r--r-- | eth/api.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/eth/api.go b/eth/api.go index af03c096d..a257639ba 100644 --- a/eth/api.go +++ b/eth/api.go @@ -1103,10 +1103,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 } |