tnmpool

package
v0.0.0-...-a0a9112 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package tnmpool is an autonomous module to handle the new-coming txs from internal or external events tnmpool's use requires some other module's initialization: - blockchain(and tnmblocks) - tnmstate - tnmp2p - storage

Index

Constants

This section is empty.

Variables

View Source
var ErrTxInvalidHeight = errors.New("invalid tx height")

Functions

This section is empty.

Types

type TxPool

type TxPool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

TxPool is a little mem db which stores **signed** tx. RULE: One Account can only send one Tx, all Txs will be accepted Every time the state updated, the old pool will be deprecated.

func Init

func Init(db *bbolt.DB, chain *blockchain.Chain, localNode *tnmp2p.LocalNode) *TxPool

func (*TxPool) GetPack

func (pool *TxPool) GetPack(height uint64) tnmtypes.TxTrie

GetPack will gives a sorted TxTire.

func (*TxPool) IsInPool

func (pool *TxPool) IsInPool(txHash []byte) (exists bool, inPoolTx *tnmtypes.FullTx)

IsInPool checks one tx is in pool or not.

func (*TxPool) PutNewTxFromLocal

func (pool *TxPool) PutNewTxFromLocal(tx *tnmtypes.FullTx) (err error)

PutNewTxFromLocal puts tx from local(rpc) into txpool.

func (*TxPool) PutNewTxFromRemote

func (pool *TxPool) PutNewTxFromRemote(tx *tnmtypes.FullTx) (err error)

PutNewTxFromRemote puts tx from local(rpc) into txpool.

func (*TxPool) PutTx

func (pool *TxPool) PutTx(tx *tnmtypes.FullTx) error

PutTx puts txs from network(p2p) or RPC into txpool, should check error before putting.

func (*TxPool) Reset

func (pool *TxPool) Reset()

Reset cleans all txs inside the pool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL