Differentiate between 0 and unspecified gas/gasprice

This commit is contained in:
Taylor Gerring
2015-05-29 14:27:15 -05:00
parent 0f1cdfa53a
commit c8a9a4e76d
4 changed files with 73 additions and 36 deletions

View File

@ -261,22 +261,22 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
args.Value = num
num = nil
if ext.Gas == nil {
num = big.NewInt(0)
} else {
if ext.Gas != nil {
if num, err = numString(ext.Gas); err != nil {
return err
}
} else {
num = nil
}
args.Gas = num
num = nil
if ext.GasPrice == nil {
num = big.NewInt(0)
} else {
if ext.GasPrice != nil {
if num, err = numString(ext.GasPrice); err != nil {
return err
}
} else {
num = nil
}
args.GasPrice = num
@ -346,21 +346,21 @@ func (args *CallArgs) UnmarshalJSON(b []byte) (err error) {
}
args.Value = num
if ext.Gas == nil {
num = big.NewInt(0)
} else {
if ext.Gas != nil {
if num, err = numString(ext.Gas); err != nil {
return err
}
} else {
num = nil
}
args.Gas = num
if ext.GasPrice == nil {
num = big.NewInt(0)
} else {
if ext.GasPrice != nil {
if num, err = numString(ext.GasPrice); err != nil {
return err
}
} else {
num = nil
}
args.GasPrice = num