core/txpool: improve error responses with wrapped errors (#30715)

pull/30539/head
piersy 2 weeks ago committed by GitHub
parent 6e1fedb12a
commit 484f0f4e84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      core/txpool/txpool.go
  2. 2
      core/txpool/validation.go

@ -358,7 +358,7 @@ func (p *TxPool) Add(txs []*types.Transaction, local bool, sync bool) []error {
for i, split := range splits { for i, split := range splits {
// If the transaction was rejected by all subpools, mark it unsupported // If the transaction was rejected by all subpools, mark it unsupported
if split == -1 { if split == -1 {
errs[i] = core.ErrTxTypeNotSupported errs[i] = fmt.Errorf("%w: received type %d", core.ErrTxTypeNotSupported, txs[i].Type())
continue continue
} }
// Find which subpool handled it and pull in the corresponding error // Find which subpool handled it and pull in the corresponding error

@ -99,7 +99,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
} }
// Make sure the transaction is signed properly // Make sure the transaction is signed properly
if _, err := types.Sender(signer, tx); err != nil { if _, err := types.Sender(signer, tx); err != nil {
return ErrInvalidSender return fmt.Errorf("%w: %v", ErrInvalidSender, err)
} }
// Ensure the transaction has more gas than the bare minimum needed to cover // Ensure the transaction has more gas than the bare minimum needed to cover
// the transaction metadata // the transaction metadata

Loading…
Cancel
Save