diff --git a/ethergo/submitter/chain_queue.go b/ethergo/submitter/chain_queue.go index 5a5e8720ed..dc05d9defb 100644 --- a/ethergo/submitter/chain_queue.go +++ b/ethergo/submitter/chain_queue.go @@ -84,8 +84,14 @@ func (t *txSubmitterImpl) chainPendingQueue(parentCtx context.Context, chainID * // so now, we have a list of transactions that need to be resubmitted. // these are already ordered by nonce and we should have at most one per nonce, so we can just iterate through them. // we need to figure out which ones are still valid, and which ones need to be bumped. - // once this is done, we'll be ready to submit them - // we're going to handle this by updating txes in place + // once this is done, we'll be ready to submit them. + // we're going to handle this by updating txes in place. + // note that if we do not have sufficient gas on this chain, no txes will be bumped. + gasBalance, err := chainClient.BalanceAt(ctx, t.signer.Address(), nil) + if err != nil { + return fmt.Errorf("could not get gas balance: %w", err) + } + span.SetAttributes(attribute.String("gas_balance", gasBalance.String())) for i := range txes { tx := txes[i] @@ -94,6 +100,11 @@ func (t *txSubmitterImpl) chainPendingQueue(parentCtx context.Context, chainID * continue } + if tx.Cost().Cmp(gasBalance) > 0 { + span.SetAttributes(attribute.Bool("out_of_gas", true)) + span.AddEvent("tx out of gas", trace.WithAttributes(txToAttributes(tx.Transaction, tx.UUID)...)) + break + } cq.bumpTX(gCtx, tx) } cq.updateOldTxStatuses(gCtx)