Skip to content

Commit 51b479e

Browse files
author
Roberto Bayardo
authored
core/txpool: elevate the 'already reserved' error into a constant (#29095)
declare the 'already reserved' error in errors.go
1 parent 5a0f468 commit 51b479e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

core/txpool/errors.go

+6
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,10 @@ var (
5454
// ErrFutureReplacePending is returned if a future transaction replaces a pending
5555
// one. Future transactions should only be able to replace other future transactions.
5656
ErrFutureReplacePending = errors.New("future transaction tries to replace pending")
57+
58+
// ErrAlreadyReserved is returned if the sender address has a pending transaction
59+
// in a different subpool. For example, this error is returned in response to any
60+
// input transaction of non-blob type when a blob transaction from this sender
61+
// remains pending (and vice-versa).
62+
ErrAlreadyReserved = errors.New("address already reserved")
5763
)

core/txpool/txpool.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (p *TxPool) reserver(id int, subpool SubPool) AddressReserver {
122122
log.Error("pool attempted to reserve already-owned address", "address", addr)
123123
return nil // Ignore fault to give the pool a chance to recover while the bug gets fixed
124124
}
125-
return errors.New("address already reserved")
125+
return ErrAlreadyReserved
126126
}
127127
p.reservations[addr] = subpool
128128
if metrics.Enabled {

0 commit comments

Comments
 (0)