From 1dbb69c6923c7d106823d7f6c5e1b734057d4221 Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Fri, 8 May 2020 19:32:05 +0800 Subject: [PATCH] accounts, internal: address comment and fix lint --- accounts/abi/bind/backends/simulated.go | 2 ++ internal/ethapi/api.go | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 238ec4f8d3..19af6f6c34 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -39,6 +39,7 @@ import ( "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/event" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" ) @@ -414,6 +415,7 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs allowance := new(big.Int).Div(balance, call.GasPrice) if hi > allowance.Uint64() { hi = allowance.Uint64() + log.Warn("Gas estimation capped by limited funds", "original", hi, "fundable", allowance) } } cap = hi diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 71534e0045..779678c4f5 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -921,7 +921,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash } hi = block.GasLimit() } - // Recap the highest gas limit with account's avaliable balance. + // Recap the highest gas limit with account's available balance. if args.GasPrice != nil && args.GasPrice.ToInt().Uint64() != 0 { state, _, err := b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) if err != nil { @@ -938,6 +938,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash allowance := new(big.Int).Div(balance, args.GasPrice.ToInt()) if hi > allowance.Uint64() { hi = allowance.Uint64() + log.Warn("Gas estimation capped by limited funds", "original", hi, "fundable", allowance) } } // Recap the highest gas allowance with specified gascap.