aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
diff options
context:
space:
mode:
authorDaniel A. Nagy <nagy.da@gmail.com>2015-05-11 21:54:19 +0800
committerDaniel A. Nagy <nagy.da@gmail.com>2015-05-11 21:54:19 +0800
commit51d4566cbf5c91e429313f1765d5a7d2afc13634 (patch)
tree48da8cd9ed6eb169df988fcfb6c2773ea410c955 /xeth
parent49559e6d5e7c365f1aa081e94cb46f3483833647 (diff)
downloadgo-tangerine-51d4566cbf5c91e429313f1765d5a7d2afc13634.tar.gz
go-tangerine-51d4566cbf5c91e429313f1765d5a7d2afc13634.tar.zst
go-tangerine-51d4566cbf5c91e429313f1765d5a7d2afc13634.zip
Only allow doSign to sign hashes, enforced by using the type common.Hash
Diffstat (limited to 'xeth')
-rw-r--r--xeth/xeth.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index 76ca4b9b4..47b833a34 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -815,8 +815,8 @@ func (self *XEth) ConfirmTransaction(tx string) bool {
return self.frontend.ConfirmTransaction(tx)
}
-func (self *XEth) doSign(from common.Address, hash []byte, didUnlock bool) ([]byte, error) {
- sig, err := self.backend.AccountManager().Sign(accounts.Account{Address: from.Bytes()}, hash)
+func (self *XEth) doSign(from common.Address, hash common.Hash, didUnlock bool) ([]byte, error) {
+ sig, err := self.backend.AccountManager().Sign(accounts.Account{Address: from.Bytes()}, hash.Bytes())
if err == accounts.ErrLocked {
if didUnlock {
return nil, fmt.Errorf("signer account still locked after successful unlock")
@@ -837,7 +837,7 @@ func (self *XEth) Sign(fromStr, hashStr string, didUnlock bool) (string, error)
from = common.HexToAddress(fromStr)
hash = common.HexToHash(hashStr)
)
- sig, err := self.doSign(from, hash.Bytes(), didUnlock)
+ sig, err := self.doSign(from, hash, didUnlock)
if err != nil {
return "", err
}
@@ -936,7 +936,7 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS
}
func (self *XEth) sign(tx *types.Transaction, from common.Address, didUnlock bool) error {
- hash := tx.Hash().Bytes()
+ hash := tx.Hash()
sig, err := self.doSign(from, hash, didUnlock)
if err != nil {
return err