tiny nits to format hexutil.Big and nil properly

This commit is contained in:
Péter Szilágyi 2020-05-11 11:06:51 +03:00
parent ec6a8df988
commit 10d605a1b4
No known key found for this signature in database
GPG key ID: E9AE538CEDF8293D
2 changed files with 10 additions and 2 deletions

View file

@ -414,8 +414,12 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs
} }
allowance := new(big.Int).Div(available, call.GasPrice) allowance := new(big.Int).Div(available, call.GasPrice)
if hi > allowance.Uint64() { if hi > allowance.Uint64() {
transfer := call.Value
if transfer == nil {
transfer = new(big.Int)
}
log.Warn("Gas estimation capped by limited funds", "original", hi, "balance", balance, log.Warn("Gas estimation capped by limited funds", "original", hi, "balance", balance,
"sent", call.Value, "gasprice", call.GasPrice, "fundable", allowance) "sent", transfer, "gasprice", call.GasPrice, "fundable", allowance)
hi = allowance.Uint64() hi = allowance.Uint64()
} }
} }

View file

@ -937,8 +937,12 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash
} }
allowance := new(big.Int).Div(available, args.GasPrice.ToInt()) allowance := new(big.Int).Div(available, args.GasPrice.ToInt())
if hi > allowance.Uint64() { if hi > allowance.Uint64() {
transfer := args.Value
if transfer == nil {
transfer = new(hexutil.Big)
}
log.Warn("Gas estimation capped by limited funds", "original", hi, "balance", balance, log.Warn("Gas estimation capped by limited funds", "original", hi, "balance", balance,
"sent", args.Value, "gasprice", args.GasPrice, "fundable", allowance) "sent", transfer.ToInt(), "gasprice", args.GasPrice.ToInt(), "fundable", allowance)
hi = allowance.Uint64() hi = allowance.Uint64()
} }
} }