Skip to content

nonce too low is not returned in eth_sendRawTransaction #31451

Closed
@adam-xu-mantle

Description

@adam-xu-mantle

System information

Geth version: geth version v1.15.5

Expected behaviour

When submitting a new transaction using eth_sendRawTransaction, if the nonce in transaction is lower than the current nonce of the sender, an error message nonce too low should be returned.

Actual behaviour

In version v1.15.5, if a transaction with a low nonce is sent using eth_sendRawTransaction, no error message is returned.

Possible Reason

In PR #31202 , when locals == nil, errors returned by txPool.Add are not propagated back to the caller. This prevents caller programs from executing corresponding processing logic based on the error messages.

func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error {
	locals := b.eth.localTxTracker
	if locals != nil {
		if err := locals.Track(signedTx); err != nil {
			return err
		}
	}
	// No error will be returned to user if the transaction fails stateful
	// validation (e.g., no available slot), as the locally submitted transactions
	// may be resubmitted later via the local tracker.
	err := b.eth.txPool.Add([]*types.Transaction{signedTx}, false)[0]
	if err != nil && locals == nil {
		return err
	}
	return nil
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions