aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-04-01 19:42:48 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-04-01 19:42:48 +0800
commitbe44651523bc44bff6a31064eb3917e4682eb866 (patch)
tree20bbb57100d4f7563cf83f4c56be099fd8804cd9 /eth
parentc58079461bafe508bea9233e2b81852df5188f57 (diff)
parent916fe112417cae924557646ba9afeb6b517e11b4 (diff)
downloaddexon-be44651523bc44bff6a31064eb3917e4682eb866.tar
dexon-be44651523bc44bff6a31064eb3917e4682eb866.tar.gz
dexon-be44651523bc44bff6a31064eb3917e4682eb866.tar.bz2
dexon-be44651523bc44bff6a31064eb3917e4682eb866.tar.lz
dexon-be44651523bc44bff6a31064eb3917e4682eb866.tar.xz
dexon-be44651523bc44bff6a31064eb3917e4682eb866.tar.zst
dexon-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')
-rw-r--r--eth/api.go8
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
}