Documentation ¶
Overview ¶
Package tx defines the data structures and methods to manage pending transactions.
Index ¶
- Variables
- func ValidateManagerContext(mc *ManagerContext) error
- type Manager
- func (tm *Manager) AddTx(txKey string, tx *ultpb.Tx) error
- func (tm *Manager) ApplyTxList(txList []*ultpb.Tx, ledgerSeqNum uint64) error
- func (tm *Manager) DeleteTxList(txList []*ultpb.Tx)
- func (tm *Manager) GetTxList() []*ultpb.Tx
- func (tm *Manager) GetTxStatus(txKey string) (*rpcpb.TxStatus, error)
- func (tm *Manager) Start()
- func (tm *Manager) Stop()
- func (tm *Manager) UpdateTxStatus(txKey string, status *rpcpb.TxStatus) error
- type ManagerContext
- type TxHistory
- type TxSlice
Constants ¶
This section is empty.
Variables ¶
var ( ErrAccountNotExist = errors.New("account not exist") ErrInsufficientForFee = errors.New("insufficient balance for fee") ErrInsufficientForTx = errors.New("insufficient balance for tx") ErrInvalidSeqNum = errors.New("invalid sequence number") ErrInvalidOpType = errors.New("invalid op type") )
var ( // Maximum number of operations in a transactions. MaxTxOpList = int(100) // Maximum length of note in a transaction. MaxTxNote = int(128) )
Functions ¶
func ValidateManagerContext ¶
func ValidateManagerContext(mc *ManagerContext) error
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages incoming tx and coordinates with ledger manager and consensus engine.
func NewManager ¶
func NewManager(ctx *ManagerContext) *Manager
NewManager creates an instance of Manager with TxManagerContext.
func (*Manager) ApplyTxList ¶
Apply the tx list by charging fees and applying all the ops.
func (*Manager) DeleteTxList ¶
Delete tx list from the manager and update internal fields.
func (*Manager) GetTxStatus ¶
Get the status of tx.
type ManagerContext ¶
type ManagerContext struct { NetworkID string Database db.Database AM *account.Manager PM *peer.Manager EM *exchange.Manager BaseReserve int64 Seed string }
ManagerContext represents contextual information TxManager needs.
type TxHistory ¶
type TxHistory struct { // Maximum sequence number of the tx list. MaxSeqNum uint64 // Total fees of the tx list. TotalFees int64 // contains filtered or unexported fields }
TxHistory is used to hold unconfirmed transactions.
func NewTxHistory ¶
func NewTxHistory() *TxHistory
func (*TxHistory) AddTx ¶
AddTx adds a transaction to pending list, note that before adding any transaction, it should be checked against signature correctness, sufficient balance of account, etc.
func (*TxHistory) DeleteTxList ¶
Delete transactions and update fields.