txpool

package
v0.0.0-...-4f0ab6e Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeChains

type FakeChains struct {
	ShardHeight map[shard.Index]int64
	Chains      map[shard.Index]*fakeChain
	// contains filtered or unexported fields
}

FakeChains is a fake struct for test.

func NewFakeChains

func NewFakeChains() *FakeChains

NewFakeChains generates a fake chains for test.

func (*FakeChains) GetLastPath

func (fc *FakeChains) GetLastPath(shardIndex shard.Index) *merkle.MerklePath

GetLastPath Returns the last path of the ledger tree for given shard.

func (*FakeChains) GetLedgerInfo

func (fc *FakeChains) GetLedgerInfo(index shard.Index) *wire.LedgerInfo

GetLedgerInfo Returns a LedgerInfo struct contains the current height of each shard and total size.

func (*FakeChains) GetNewBlock

func (fc *FakeChains) GetNewBlock(shardIndex shard.Index, txps ...*wire.MsgTxWithProofs) *wire.MsgBlock

GetNewBlock returns a new MsgBlock given a shardIndex and some MsgTxWithProofs.

func (*FakeChains) GetNewTx

func (fc *FakeChains) GetNewTx(shardIndex shard.Index) *wire.MsgTxWithProofs

GetNewTx Generate a Tx with proofs. The inputs will be deleted immediately form the fake chains.

type TxDesc

type TxDesc struct {
	Tx       wire.MsgTxWithProofs
	Priority float64
}

TxDesc contains a Tx and the Tx's priority based on fee.

type TxPool

type TxPool interface {
	AddNewTransaction(tx *wire.MsgTxWithProofs, root *merkle.MerkleHash) (*TxDesc, error)
	VerifyTransaction(tx *wire.MsgTxWithProofs, root *merkle.MerkleHash) error
	GetTopTransactions(number int, update *state.Update, height int64) []*wire.MsgTxWithProofs
	NumberOfTransactions() int
	RefreshPool(update *state.Update)
}

TxPool is a interface that contains some methods used to add, verify and get transactions with proofs.

func NewTxPool

func NewTxPool() TxPool

NewTxPool returns a new instance of txPool.

Jump to

Keyboard shortcuts

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