From 46df50be181afca503aff4a545e3f322ad04448b Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 5 Apr 2016 01:08:50 +0200 Subject: accounts: improve API and add documentation - Sign takes common.Address, not Account - Import/Export methods work with encrypted JSON keys --- eth/api.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'eth/api.go') diff --git a/eth/api.go b/eth/api.go index b82a1addd..508070646 100644 --- a/eth/api.go +++ b/eth/api.go @@ -1086,9 +1086,8 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(txHash common.Hash) (ma } // sign is a helper function that signs a transaction with the private key of the given address. -func (s *PublicTransactionPoolAPI) sign(address common.Address, tx *types.Transaction) (*types.Transaction, error) { - acc := accounts.Account{Address: address} - signature, err := s.am.Sign(acc, tx.SigHash().Bytes()) +func (s *PublicTransactionPoolAPI) sign(addr common.Address, tx *types.Transaction) (*types.Transaction, error) { + signature, err := s.am.Sign(addr, tx.SigHash().Bytes()) if err != nil { return nil, err } @@ -1181,10 +1180,10 @@ func (s *PublicTransactionPoolAPI) SendRawTransaction(encodedTx string) (string, return tx.Hash().Hex(), nil } -// 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[:]) +// 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(addr common.Address, hash common.Hash) (string, error) { + signature, error := s.am.Sign(addr, hash[:]) return common.ToHex(signature), error } -- cgit v1.2.3