Documentation
¶
Overview ¶
Package txpool provides transaction pool which maintain transactions by nonce asc and fee desc order.
Index ¶
- Constants
- type ABI
- type DatabaseReader
- type EventNewTransactionAnnouncementMessage
- type EventNewTransactionMessage
- type FeeMaxHeap
- type FeeMinHeap
- type GetTransactionsResponse
- func (e *GetTransactionsResponse) Decode(data []byte) error
- func (e *GetTransactionsResponse) DecodeFromReader(reader *codec.Reader) error
- func (e *GetTransactionsResponse) DecodeStrict(data []byte) error
- func (e *GetTransactionsResponse) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *GetTransactionsResponse) Encode() []byte
- func (e *GetTransactionsResponse) MustDecode(data []byte)
- type NonceMinHeap
- type TransactionPool
- func (t *TransactionPool) Add(tx *blockchain.Transaction) bool
- func (t *TransactionPool) End()
- func (t *TransactionPool) Get(id []byte) (*blockchain.Transaction, bool)
- func (t *TransactionPool) GetAll() []*blockchain.Transaction
- func (t *TransactionPool) GetProcessable() []*blockchain.Transaction
- func (t *TransactionPool) HandleRPCEndpointGetTransaction(w p2p.ResponseWriter, r *p2p.Request)
- func (t *TransactionPool) Init(ctx context.Context, logger log.Logger, database *db.DB, ...) error
- func (t *TransactionPool) Remove(id []byte) bool
- func (t *TransactionPool) Start()
- func (t *TransactionPool) Subscribe(topic string) <-chan interface{}
- type TransactionPoolConfig
- type TransactionWithFeePriority
Constants ¶
View Source
const ( EventTransactionNew = "EventTransactionNew" EventTransactionAnnouncement = "EventTransactionAnnouncement" )
View Source
const ( RPCEventPostTransactionAnnouncement = "postTransactionsAnnouncement" RPCEndpointGetTransactions = "getTransactions" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ABI ¶
type ABI interface {
VerifyTransaction(req *labi.VerifyTransactionRequest) (*labi.VerifyTransactionResponse, error)
}
type DatabaseReader ¶
type EventNewTransactionMessage ¶
type EventNewTransactionMessage struct {
Transaction *blockchain.Transaction `json:"transaction"`
}
type FeeMaxHeap ¶
type FeeMaxHeap []*TransactionWithFeePriority
func (FeeMaxHeap) Len ¶
func (h FeeMaxHeap) Len() int
func (FeeMaxHeap) Less ¶
func (h FeeMaxHeap) Less(i, j int) bool
func (*FeeMaxHeap) Pop ¶
func (h *FeeMaxHeap) Pop() interface{}
func (*FeeMaxHeap) Push ¶
func (h *FeeMaxHeap) Push(x interface{})
func (FeeMaxHeap) Swap ¶
func (h FeeMaxHeap) Swap(i, j int)
type FeeMinHeap ¶
type FeeMinHeap []*TransactionWithFeePriority
func (FeeMinHeap) Len ¶
func (h FeeMinHeap) Len() int
func (FeeMinHeap) Less ¶
func (h FeeMinHeap) Less(i, j int) bool
func (*FeeMinHeap) Pop ¶
func (h *FeeMinHeap) Pop() interface{}
func (*FeeMinHeap) Push ¶
func (h *FeeMinHeap) Push(x interface{})
func (FeeMinHeap) Swap ¶
func (h FeeMinHeap) Swap(i, j int)
type GetTransactionsResponse ¶
type GetTransactionsResponse struct {
Transactions []*blockchain.Transaction `json:"transactions" fieldNumber:"1"`
}
func (*GetTransactionsResponse) Decode ¶
func (e *GetTransactionsResponse) Decode(data []byte) error
func (*GetTransactionsResponse) DecodeFromReader ¶
func (e *GetTransactionsResponse) DecodeFromReader(reader *codec.Reader) error
func (*GetTransactionsResponse) DecodeStrict ¶
func (e *GetTransactionsResponse) DecodeStrict(data []byte) error
func (*GetTransactionsResponse) DecodeStrictFromReader ¶
func (e *GetTransactionsResponse) DecodeStrictFromReader(reader *codec.Reader) error
func (*GetTransactionsResponse) Encode ¶
func (e *GetTransactionsResponse) Encode() []byte
func (*GetTransactionsResponse) MustDecode ¶
func (e *GetTransactionsResponse) MustDecode(data []byte)
type NonceMinHeap ¶
type NonceMinHeap []uint64
func (NonceMinHeap) Len ¶
func (h NonceMinHeap) Len() int
func (NonceMinHeap) Less ¶
func (h NonceMinHeap) Less(i, j int) bool
func (*NonceMinHeap) Pop ¶
func (h *NonceMinHeap) Pop() interface{}
func (*NonceMinHeap) Push ¶
func (h *NonceMinHeap) Push(x interface{})
func (NonceMinHeap) Swap ¶
func (h NonceMinHeap) Swap(i, j int)
type TransactionPool ¶
type TransactionPool struct {
// contains filtered or unexported fields
}
func NewTransactionPool ¶
func NewTransactionPool(cfg *TransactionPoolConfig) *TransactionPool
func (*TransactionPool) Add ¶
func (t *TransactionPool) Add(tx *blockchain.Transaction) bool
func (*TransactionPool) End ¶
func (t *TransactionPool) End()
func (*TransactionPool) Get ¶
func (t *TransactionPool) Get(id []byte) (*blockchain.Transaction, bool)
func (*TransactionPool) GetAll ¶
func (t *TransactionPool) GetAll() []*blockchain.Transaction
func (*TransactionPool) GetProcessable ¶
func (t *TransactionPool) GetProcessable() []*blockchain.Transaction
func (*TransactionPool) HandleRPCEndpointGetTransaction ¶
func (t *TransactionPool) HandleRPCEndpointGetTransaction(w p2p.ResponseWriter, r *p2p.Request)
func (*TransactionPool) Remove ¶
func (t *TransactionPool) Remove(id []byte) bool
func (*TransactionPool) Start ¶
func (t *TransactionPool) Start()
func (*TransactionPool) Subscribe ¶
func (t *TransactionPool) Subscribe(topic string) <-chan interface{}
type TransactionPoolConfig ¶
type TransactionPoolConfig struct { MaxTransactions int `json:"maxTransactions"` MaxTransactionsPerAccount int `json:"maxTransactionsPerAccount"` TransactionExpiryTime int `json:"transactionExpiryTime"` MinEntranceFeePriority uint64 `json:"minEntranceFeePriority,string"` MinReplacementFeeDifference uint64 `json:"minReplacementFeeDifference,string"` }
func (*TransactionPoolConfig) SetDefault ¶
func (c *TransactionPoolConfig) SetDefault()
type TransactionWithFeePriority ¶
type TransactionWithFeePriority struct { *blockchain.Transaction FeePriority uint64 // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.