Commit 916fe112 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke

eth: enforce signing hashes using eth_sign instead of arbitrary data

parent 10d3466c
...@@ -1102,10 +1102,10 @@ func (s *PublicTransactionPoolAPI) SendRawTransaction(encodedTx string) (string, ...@@ -1102,10 +1102,10 @@ func (s *PublicTransactionPoolAPI) SendRawTransaction(encodedTx string) (string,
return tx.Hash().Hex(), nil return tx.Hash().Hex(), nil
} }
// Sign will sign the given data string with the given address. The account corresponding with the address needs to // Sign signs the given hash using the key that matches the address. The key must be unlocked in order to sign the
// be unlocked. // hash.
func (s *PublicTransactionPoolAPI) Sign(address common.Address, data string) (string, error) { func (s *PublicTransactionPoolAPI) Sign(address common.Address, hash common.Hash) (string, error) {
signature, error := s.am.Sign(accounts.Account{Address: address}, common.HexToHash(data).Bytes()) signature, error := s.am.Sign(accounts.Account{Address: address}, hash[:])
return common.ToHex(signature), error return common.ToHex(signature), error
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment