mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
core, miner: log gas limit error when pack transactions (#1905)
This commit is contained in:
parent
51e3c866c8
commit
be5cfd9756
3 changed files with 6 additions and 6 deletions
|
|
@ -38,7 +38,7 @@ func (gp *GasPool) AddGas(amount uint64) *GasPool {
|
|||
// available and returns an error otherwise.
|
||||
func (gp *GasPool) SubGas(amount uint64) error {
|
||||
if uint64(*gp) < amount {
|
||||
return ErrGasLimitReached
|
||||
return fmt.Errorf("%w, have: %d, need: %d", ErrGasLimitReached, uint64(*gp), amount)
|
||||
}
|
||||
*(*uint64)(gp) -= amount
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ func TestStateProcessorErrors(t *testing.T) {
|
|||
txs: []*types.Transaction{
|
||||
makeTx(key1, 0, common.Address{}, big.NewInt(0), 21000000, big.NewInt(12500000000), nil),
|
||||
},
|
||||
want: "could not apply tx 0 [0x062b0e84f2d48f09f91e434fca8cb1fb864c4fb82f8bf27d58879ebe60c9f773]: gas limit reached",
|
||||
want: "could not apply tx 0 [0x062b0e84f2d48f09f91e434fca8cb1fb864c4fb82f8bf27d58879ebe60c9f773]: gas limit reached, have: 4712388, need: 21000000",
|
||||
},
|
||||
{ // ErrInsufficientFundsForTransfer
|
||||
txs: []*types.Transaction{
|
||||
|
|
@ -186,7 +186,7 @@ func TestStateProcessorErrors(t *testing.T) {
|
|||
txs: []*types.Transaction{
|
||||
makeTx(key1, 0, common.Address{}, big.NewInt(0), params.TxGas*1000, big.NewInt(12500000000), nil),
|
||||
},
|
||||
want: "could not apply tx 0 [0x062b0e84f2d48f09f91e434fca8cb1fb864c4fb82f8bf27d58879ebe60c9f773]: gas limit reached",
|
||||
want: "could not apply tx 0 [0x062b0e84f2d48f09f91e434fca8cb1fb864c4fb82f8bf27d58879ebe60c9f773]: gas limit reached, have: 4712388, need: 21000000",
|
||||
},
|
||||
{ // ErrFeeCapTooLow
|
||||
txs: []*types.Transaction{
|
||||
|
|
|
|||
|
|
@ -970,7 +970,7 @@ func (w *Work) commitTransactions(mux *event.TypeMux, balanceFee map[common.Addr
|
|||
}
|
||||
|
||||
if gp.Gas() < params.TxGas && tx.Gas() > 0 {
|
||||
log.Trace("Not enough gas for further transactions", "gp", gp)
|
||||
log.Warn("Not enough gas for further transactions", "hash", tx.Hash().Hex(), "tx.Gas", tx.Gas(), "gp", gp, "need", params.TxGas)
|
||||
break
|
||||
}
|
||||
// Error may be ignored here. The error has already been checked
|
||||
|
|
@ -1033,7 +1033,7 @@ func (w *Work) commitTransactions(mux *event.TypeMux, balanceFee map[common.Addr
|
|||
for {
|
||||
// If we don't have enough gas for any further transactions then we're done
|
||||
if gp.Gas() < params.TxGas {
|
||||
log.Trace("Not enough gas for further transactions", "gp", gp)
|
||||
log.Warn("Not enough gas for further transactions", "gp", gp, "need", params.TxGas)
|
||||
break
|
||||
}
|
||||
if txs == nil {
|
||||
|
|
@ -1115,7 +1115,7 @@ func (w *Work) commitTransactions(mux *event.TypeMux, balanceFee map[common.Addr
|
|||
switch {
|
||||
case errors.Is(err, core.ErrGasLimitReached):
|
||||
// Pop the current out-of-gas transaction without shifting in the next from the account
|
||||
log.Trace("Gas limit exceeded for current block", "sender", from)
|
||||
log.Warn("Gas limit exceeded for current block", "hash", tx.Hash().Hex(), "tx.Gas", tx.Gas(), "err", err)
|
||||
txs.Pop()
|
||||
|
||||
case errors.Is(err, core.ErrNonceTooLow):
|
||||
|
|
|
|||
Loading…
Reference in a new issue