Documentation ¶
Overview ¶
Package utxodb implements UTXO selection and reservation.
Index ¶
- Variables
- type Change
- type Reserver
- func (res *Reserver) ExpireReservations(ctx context.Context, period time.Duration)
- func (res *Reserver) Reserve(ctx context.Context, sources []Source, exp time.Time) (u []*UTXO, c []Change, err error)
- func (res *Reserver) ReserveUTXO(ctx context.Context, txHash bc.Hash, pos uint32, clientToken *string, ...) (*UTXO, error)
- type Source
- type UTXO
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInsufficient indicates the account doesn't contain enough // units of the requested asset to satisfy the reservation. // New units must be deposited into the account in order to // satisfy the request; change will not be sufficient. ErrInsufficient = errors.New("reservation found insufficient funds") // ErrReserved indicates that a reservation could not be // satisfied because some of the outputs were already reserved. // When those reservations are finalized into a transaction // (and no other transaction spends funds from the account), // new change outputs will be created // in sufficient amounts to satisfy the request. ErrReserved = errors.New("reservation found outputs already reserved") )
Functions ¶
This section is empty.
Types ¶
type Change ¶
Change represents reserved units beyond what was asked for. Total reservation is for Amount+Source.Amount.
type Reserver ¶
func (*Reserver) ExpireReservations ¶
ExpireReservations is meant to be run as a goroutine. It loops, calling the expire_reservations() pl/pgsql function to remove expired reservations from the reservations table. It returns when its context is canceled.
Click to show internal directories.
Click to hide internal directories.