Skip to content

Commit e44cfee

Browse files
committed
core/txpool: Improve error responses
I noticed that these two responses can make their way back to the transaction submitter when submitting unsupported tx types. Adding the extra context makes it easier for the submitter to understand what went wrong. Particularly in the case of the invalid sender response, which is returned when an unsupported transaction type is encountered.
1 parent e9467ee commit e44cfee

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

core/txpool/txpool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ func (p *TxPool) Add(txs []*types.Transaction, local bool, sync bool) []error {
341341
for i, split := range splits {
342342
// If the transaction was rejected by all subpools, mark it unsupported
343343
if split == -1 {
344-
errs[i] = core.ErrTxTypeNotSupported
344+
errs[i] = fmt.Errorf("%w (type %d)", core.ErrTxTypeNotSupported, txs[i].Type())
345345
continue
346346
}
347347
// Find which subpool handled it and pull in the corresponding error

core/txpool/validation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
9999
}
100100
// Make sure the transaction is signed properly
101101
if _, err := types.Sender(signer, tx); err != nil {
102-
return ErrInvalidSender
102+
return fmt.Errorf("%w: %w", ErrInvalidSender, err)
103103
}
104104
// Ensure the transaction has more gas than the bare minimum needed to cover
105105
// the transaction metadata

0 commit comments

Comments
 (0)