aboutsummaryrefslogtreecommitdiffstats
path: root/eth/api.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2016-04-01 06:43:14 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2016-04-01 06:43:14 +0800
commit916fe112417cae924557646ba9afeb6b517e11b4 (patch)
tree369156fd6d13d1516d1ee6541c06cdabe6b41c3b /eth/api.go
parent10d3466c934bd425a8c941270749a652a588527d (diff)
downloaddexon-916fe112417cae924557646ba9afeb6b517e11b4.tar.gz
dexon-916fe112417cae924557646ba9afeb6b517e11b4.tar.zst
dexon-916fe112417cae924557646ba9afeb6b517e11b4.zip
eth: enforce signing hashes using eth_sign instead of arbitrary data
Diffstat (limited to 'eth/api.go')
-rw-r--r--eth/api.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/eth/api.go b/eth/api.go
index 4a03a0940..80acd6910 100644
--- a/eth/api.go
+++ b/eth/api.go
@@ -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
}