Skip to content

Commit 2340de4

Browse files
authored
Apply suggestions from code review
1 parent 482194f commit 2340de4

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

core/tx_pool.go

+5
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,9 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
826826
}
827827
return have, math.MaxInt
828828
}
829+
// Transaction takes a new nonce value out of the pool. Ensure it doesn't
830+
// overflow the number of permitted transactions from a single account
831+
// (i.e. max cancellable via out-of-bound transaction).
829832
if used, left := usedAndLeftSlots(from); left <= 0 {
830833
return fmt.Errorf("%w: pooled %d txs", ErrAccountLimitExceeded, used)
831834
}
@@ -841,6 +844,8 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
841844
}
842845
return conflicts
843846
}
847+
// Verify no authorizations will invalidate existing transactions known to
848+
// the pool.
844849
if conflicts := knownConflicts(tx.SetCodeAuthorities()); len(conflicts) > 0 {
845850
return fmt.Errorf("%w: authorization conflicts with other known tx", ErrAuthorityReserved)
846851
}

core/types/transaction_marshalling.go

+3
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,9 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error {
452452
if overflow {
453453
return errors.New("'chainId' value overflows uint256")
454454
}
455+
if dec.Nonce == nil {
456+
return errors.New("missing required field 'nonce' in transaction")
457+
}
455458
itx.Nonce = uint64(*dec.Nonce)
456459
if dec.To == nil {
457460
return errors.New("missing required field 'to' in transaction")

0 commit comments

Comments
 (0)