aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-11-02 20:44:13 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-11-13 21:55:30 +0800
commit4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188 (patch)
tree5c55a3088c944ddf517aa4d7c85c5dc7f02d00e4 /common
parent5cd86443ee071b5e3abe4995c777ce467c29f2c5 (diff)
downloadgo-tangerine-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.tar
go-tangerine-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.tar.gz
go-tangerine-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.tar.bz2
go-tangerine-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.tar.lz
go-tangerine-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.tar.xz
go-tangerine-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.tar.zst
go-tangerine-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.zip
core/types, params: EIP#155
Diffstat (limited to 'common')
-rw-r--r--common/registrar/ethreg/api.go28
1 files changed, 12 insertions, 16 deletions
diff --git a/common/registrar/ethreg/api.go b/common/registrar/ethreg/api.go
index bbc34f6ac..a3c48345e 100644
--- a/common/registrar/ethreg/api.go
+++ b/common/registrar/ethreg/api.go
@@ -174,25 +174,20 @@ func (be *registryAPIBackend) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr
from.SetBalance(common.MaxBig)
- msg := callmsg{
- from: from,
- gas: common.Big(gasStr),
- gasPrice: common.Big(gasPriceStr),
- value: common.Big(valueStr),
- data: common.FromHex(dataStr),
- }
+ var to *common.Address
if len(toStr) > 0 {
addr := common.HexToAddress(toStr)
- msg.to = &addr
+ to = &addr
}
-
- if msg.gas.Cmp(big.NewInt(0)) == 0 {
- msg.gas = big.NewInt(50000000)
+ gas := common.Big(gasStr)
+ if gas.BitLen() == 0 {
+ gas = big.NewInt(50000000)
}
-
- if msg.gasPrice.Cmp(big.NewInt(0)) == 0 {
- msg.gasPrice = new(big.Int).Mul(big.NewInt(50), common.Shannon)
+ gasPrice := common.Big(gasPriceStr)
+ if gasPrice.BitLen() == 0 {
+ gasPrice = new(big.Int).Mul(big.NewInt(50), common.Shannon)
}
+ msg := types.NewMessage(from.Address(), to, 0, common.Big(valueStr), gas, gasPrice, common.FromHex(dataStr))
header := be.bc.CurrentBlock().Header()
vmenv := core.NewEnv(statedb, be.config, be.bc, msg, header, vm.Config{})
@@ -258,11 +253,12 @@ func (be *registryAPIBackend) Transact(fromStr, toStr, nonceStr, valueStr, gasSt
tx = types.NewTransaction(nonce, to, value, gas, price, data)
}
- signature, err := be.am.SignEthereum(from, tx.SigHash().Bytes())
+ sigHash := (types.HomesteadSigner{}).Hash(tx)
+ signature, err := be.am.SignEthereum(from, sigHash.Bytes())
if err != nil {
return "", err
}
- signedTx, err := tx.WithSignature(signature)
+ signedTx, err := tx.WithSignature(types.HomesteadSigner{}, signature)
if err != nil {
return "", err
}