From 10d605a1b43e1ce8a4a3205e9e9d26dfa5dccc92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 11 May 2020 11:06:51 +0300 Subject: [PATCH] tiny nits to format hexutil.Big and nil properly --- accounts/abi/bind/backends/simulated.go | 6 +++++- internal/ethapi/api.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index e1d8fcd782..cfbe2914d5 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -414,8 +414,12 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs } allowance := new(big.Int).Div(available, call.GasPrice) 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, - "sent", call.Value, "gasprice", call.GasPrice, "fundable", allowance) + "sent", transfer, "gasprice", call.GasPrice, "fundable", allowance) hi = allowance.Uint64() } } diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 195da54fcd..45240aa2cf 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -937,8 +937,12 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash } allowance := new(big.Int).Div(available, args.GasPrice.ToInt()) 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, - "sent", args.Value, "gasprice", args.GasPrice, "fundable", allowance) + "sent", transfer.ToInt(), "gasprice", args.GasPrice.ToInt(), "fundable", allowance) hi = allowance.Uint64() } }