mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
accounts, internal: address comment and fix lint
This commit is contained in:
parent
d3b553df82
commit
1dbb69c692
2 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue