aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/xeth.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-05-30 03:27:15 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-06-09 20:13:25 +0800
commitc8a9a4e76d00483280a51bb6c0f9517d6c531589 (patch)
tree7b5b8de46655614b157aab9a21fc76d0f51ba0ec /xeth/xeth.go
parent0f1cdfa53ad445df7bf3aed281fc36e53ecbbfd4 (diff)
downloadgo-tangerine-c8a9a4e76d00483280a51bb6c0f9517d6c531589.tar
go-tangerine-c8a9a4e76d00483280a51bb6c0f9517d6c531589.tar.gz
go-tangerine-c8a9a4e76d00483280a51bb6c0f9517d6c531589.tar.bz2
go-tangerine-c8a9a4e76d00483280a51bb6c0f9517d6c531589.tar.lz
go-tangerine-c8a9a4e76d00483280a51bb6c0f9517d6c531589.tar.xz
go-tangerine-c8a9a4e76d00483280a51bb6c0f9517d6c531589.tar.zst
go-tangerine-c8a9a4e76d00483280a51bb6c0f9517d6c531589.zip
Differentiate between 0 and unspecified gas/gasprice
Diffstat (limited to 'xeth/xeth.go')
-rw-r--r--xeth/xeth.go33
1 files changed, 19 insertions, 14 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index d0d51bfe0..9b49b412c 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -885,12 +885,29 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS
from = common.HexToAddress(fromStr)
to = common.HexToAddress(toStr)
value = common.Big(valueStr)
- gas = common.Big(gasStr)
- price = common.Big(gasPriceStr)
+ gas *big.Int
+ price *big.Int
data []byte
contractCreation bool
)
+ if len(gasStr) == 0 {
+ gas = DefaultGas()
+ } else {
+ gas = common.Big(gasStr)
+ }
+
+ if len(gasPriceStr) == 0 {
+ price = DefaultGasPrice()
+ } else {
+ price = common.Big(gasPriceStr)
+ }
+
+ data = common.FromHex(codeStr)
+ if len(toStr) == 0 {
+ contractCreation = true
+ }
+
// 2015-05-18 Is this still needed?
// TODO if no_private_key then
//if _, exists := p.register[args.From]; exists {
@@ -916,18 +933,6 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS
// TODO: align default values to have the same type, e.g. not depend on
// common.Value conversions later on
- if gas.Cmp(big.NewInt(0)) == 0 {
- gas = DefaultGas()
- }
-
- if price.Cmp(big.NewInt(0)) == 0 {
- price = DefaultGasPrice()
- }
-
- data = common.FromHex(codeStr)
- if len(toStr) == 0 {
- contractCreation = true
- }
var tx *types.Transaction
if contractCreation {