Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultTestChainHeight = uint64(1) DefaultTestBatchSize = uint64(4) DefaultTestTxSetSize = uint64(1) )
View Source
const ( DefaultPoolSize = 50000 DefaultTxCacheSize = 10000 DefaultBatchSize = 500 DefaultTxSetSize = 10 DefaultTxSetTick = 100 * time.Millisecond )
Variables ¶
View Source
var (
InterchainContractAddr = types.NewAddressByStr("000000000000000000000000000000000000000a")
)
Functions ¶
This section is empty.
Types ¶
type ChainState ¶ added in v1.4.0
type Config ¶
type Config struct { ID uint64 BatchSize uint64 PoolSize uint64 IsTimed bool BlockTimeout time.Duration RebroadcastTimeout time.Duration TxSliceSize uint64 TxSliceTimeout time.Duration ChainHeight uint64 Logger logrus.FieldLogger StoragePath string // db for persist mem pool meta data GetAccountNonce GetAccountNonceFunc }
type External ¶ added in v1.4.0
type External interface { // GetPendingNonceByAccount will return the latest pending nonce of a given account GetPendingNonceByAccount(account string) uint64 GetPendingTransactions(max int) []pb.Transaction GetTransaction(hash *types.Hash) pb.Transaction // IsPoolFull check if memPool has exceeded the limited txSize. IsPoolFull() bool }
External is a concurrent and safe interface, which can be called by api module directly.
type GetAccountNonceFunc ¶ added in v1.6.1
type MemPool ¶
type MemPool interface { // ProcessTransactions process transaction from api and other vp nodes. ProcessTransactions(txs []pb.Transaction, isLeader, isLocal bool) *raftproto.RequestBatch // GenerateBlock generate a block GenerateBlock() *raftproto.RequestBatch // CommitTransactions Remove removes the committed transactions from mempool CommitTransactions(state *ChainState) // HasPendingRequest checks if there is non-batched tx(s) in mempool pool or not HasPendingRequest() bool SetBatchSeqNo(batchSeq uint64) GetTimeoutTransactions(rebroadcastDuration time.Duration) [][]pb.Transaction // RemoveAliveTimeoutTxs get the remained local txs in timeoutIndex and removeTxs in memPool by tolerance time. RemoveAliveTimeoutTxs(removeDuration time.Duration) uint64 SubscribeTxEvent(chan<- pb.Transactions) event.Subscription External }
func NewMempool ¶
NewMempool return the mempool instance.
type TxCache ¶
type TxCache struct { TxSetC chan *pb.Transactions RecvTxC chan pb.Transaction TxRespC chan *TxWithResp // contains filtered or unexported fields }
func NewTxCache ¶ added in v1.4.0
func (*TxCache) ListenEvent ¶ added in v1.4.0
type TxWithResp ¶ added in v1.9.0
type TxWithResp struct { Tx pb.Transaction Ch chan bool }
Click to show internal directories.
Click to hide internal directories.