accounts, internal: address comment and fix lint

This commit is contained in:
rjl493456442 2020-05-08 19:32:05 +08:00
parent d3b553df82
commit 1dbb69c692
2 changed files with 4 additions and 1 deletions

View file

@ -39,6 +39,7 @@ import (
"github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc" "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) allowance := new(big.Int).Div(balance, call.GasPrice)
if hi > allowance.Uint64() { if hi > allowance.Uint64() {
hi = allowance.Uint64() hi = allowance.Uint64()
log.Warn("Gas estimation capped by limited funds", "original", hi, "fundable", allowance)
} }
} }
cap = hi cap = hi

View file

@ -921,7 +921,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash
} }
hi = block.GasLimit() 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 { if args.GasPrice != nil && args.GasPrice.ToInt().Uint64() != 0 {
state, _, err := b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) state, _, err := b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
if err != nil { 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()) allowance := new(big.Int).Div(balance, args.GasPrice.ToInt())
if hi > allowance.Uint64() { if hi > allowance.Uint64() {
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. // Recap the highest gas allowance with specified gascap.