diff options
Diffstat (limited to 'common/registrar/ethreg/api.go')
-rw-r--r-- | common/registrar/ethreg/api.go | 28 |
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 } |