Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyReserved = errors.New("address already reserved")
ErrAlreadyReserved is returned if the sender address has a pending transaction in a different subpool. For example, this error is returned in response to any input transaction of non-blob type when a blob transaction from this sender remains pending (and vice-versa).
Functions ¶
This section is empty.
Types ¶
type ReservationHandle ¶
type ReservationHandle struct {
// contains filtered or unexported fields
}
ReservationHandle is a named handle on ReservationTracker. It is held by Subpools to make reservations for accounts it is tracking. The id is used to determine which pool owns an address and disallows non-owners to hold or release addresses it doesn't own.
func (*ReservationHandle) Has ¶
func (h *ReservationHandle) Has(address common.Address) bool
Has implements the Reserver interface.
type ReservationTracker ¶
type ReservationTracker struct {
// contains filtered or unexported fields
}
ReservationTracker is a struct shared between different Subpools. It is used to reserve the account and ensure that one address cannot initiate transactions, authorizations, and other state-changing behaviors in different pools at the same time.
func NewReservationTracker ¶
func NewReservationTracker() *ReservationTracker
NewReservationTracker initializes the account reservation tracker.
func (*ReservationTracker) NewHandle ¶
func (r *ReservationTracker) NewHandle(id int) *ReservationHandle
NewHandle creates a named handle on the ReservationTracker. The handle identifies the subpool so ownership of reservations can be determined.
type Reserver ¶
type Reserver interface {
// Hold attempts to reserve the specified account address for the given pool.
// Returns an error if the account is already reserved.
Hold(addr ...common.Address) error
// Release attempts to release the reservation for the specified account.
// Returns an error if the address is not reserved or is reserved by another pool.
Release(addr ...common.Address) error
// Has returns a flag indicating if the address has been reserved by a pool
// other than one with the current Reserver handle.
Has(address common.Address) bool
}
Reserver is an interface for creating and releasing owned reservations in the ReservationTracker struct, which is shared between Subpools.