Documentation ¶
Overview ¶
Copyright (C) THL A29 Limited, a Tencent company. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- Variables
- func IsMetrics() bool
- func IsTxTimeVerify(chainConf protocol.ChainConf) bool
- func MaxCommonTxPoolSize() int
- func MaxConfigTxPoolSize() int
- func MaxTxCount(chainConf protocol.ChainConf) int
- func MaxTxTimeTimeout(chainConf protocol.ChainConf) float64
- func NewBatchTxPool(nodeId string, chainId string, chainStore protocol.BlockchainStore, ...) (protocol.TxPool, error)
- type BatchTxPool
- func (p *BatchTxPool) AddTx(tx *commonPb.Transaction, src protocol.TxSource) error
- func (p *BatchTxPool) AddTxsToPendingCache(txs []*commonPb.Transaction, blockHeight uint64)
- func (p *BatchTxPool) Apply(opts ...Option) error
- func (p *BatchTxPool) FetchTxBatch(blockHeight uint64) []*commonPb.Transaction
- func (p *BatchTxPool) GetTxByTxId(txId string) (tx *commonPb.Transaction, inBlockHeight uint64)
- func (p *BatchTxPool) GetTxsByTxIds(txIds []string) (map[string]*commonPb.Transaction, map[string]uint64)
- func (p *BatchTxPool) OnMessage(message *msgbus.Message)
- func (p *BatchTxPool) OnQuit()
- func (p *BatchTxPool) RetryAndRemoveTxs(retryTxs []*commonPb.Transaction, removeTxs []*commonPb.Transaction)
- func (p *BatchTxPool) SetBatchCreateTimeout(timeout time.Duration)
- func (p *BatchTxPool) SetBatchMaxSize(size int)
- func (p *BatchTxPool) SetMsgBus(msgBus msgbus.MessageBus)
- func (p *BatchTxPool) SetPoolSize(size int)
- func (p *BatchTxPool) Start() error
- func (p *BatchTxPool) Stop() error
- func (p *BatchTxPool) TxExists(tx *commonPb.Transaction) bool
- type Option
Constants ¶
View Source
const ( DefaultBatchMaxSize = 100 DefaultBatchCreateTimeout = 1000 * time.Millisecond DefaultPoolSize = 10000 TxPoolType = "BATCH" )
View Source
const ( DefaultMaxTxCount = 1000 // Maximum number of transactions in a block DefaultMaxTxPoolSize = 5120 // Maximum number of common transaction in the pool DefaultMaxConfigTxPoolSize = 100 // Maximum number of config transaction in the pool DefaultMaxTxTimeTimeout = float64(600) // The unit is in seconds )
Variables ¶
View Source
var (
TxPoolConfig *txPoolConfig
)
Functions ¶
func IsTxTimeVerify ¶
func IsTxTimeVerify(chainConf protocol.ChainConf) bool
===========config in the blockchain============ IsTxTimeVerify Whether transactions require validation
func MaxCommonTxPoolSize ¶
func MaxCommonTxPoolSize() int
===========config in the local============ MaxCommonTxPoolSize Maximum number of common transaction in the pool
func MaxConfigTxPoolSize ¶
func MaxConfigTxPoolSize() int
MaxConfigTxPoolSize The maximum number of configure transaction in the pool
func MaxTxCount ¶
func MaxTxCount(chainConf protocol.ChainConf) int
MaxTxCount Maximum number of transactions in a block
func MaxTxTimeTimeout ¶
func MaxTxTimeTimeout(chainConf protocol.ChainConf) float64
MaxTxTimeTimeout The maximum timeout for a transaction
func NewBatchTxPool ¶
Types ¶
type BatchTxPool ¶
type BatchTxPool struct {
// contains filtered or unexported fields
}
BatchTxPool Another implementation of tx pool, which can only be used in non-Hotstuff consensus algorithms
func (*BatchTxPool) AddTx ¶
func (p *BatchTxPool) AddTx(tx *commonPb.Transaction, src protocol.TxSource) error
func (*BatchTxPool) AddTxsToPendingCache ¶
func (p *BatchTxPool) AddTxsToPendingCache(txs []*commonPb.Transaction, blockHeight uint64)
func (*BatchTxPool) Apply ¶
func (p *BatchTxPool) Apply(opts ...Option) error
func (*BatchTxPool) FetchTxBatch ¶
func (p *BatchTxPool) FetchTxBatch(blockHeight uint64) []*commonPb.Transaction
func (*BatchTxPool) GetTxByTxId ¶
func (p *BatchTxPool) GetTxByTxId(txId string) (tx *commonPb.Transaction, inBlockHeight uint64)
func (*BatchTxPool) GetTxsByTxIds ¶
func (p *BatchTxPool) GetTxsByTxIds(txIds []string) (map[string]*commonPb.Transaction, map[string]uint64)
func (*BatchTxPool) OnMessage ¶
func (p *BatchTxPool) OnMessage(message *msgbus.Message)
func (*BatchTxPool) OnQuit ¶
func (p *BatchTxPool) OnQuit()
func (*BatchTxPool) RetryAndRemoveTxs ¶
func (p *BatchTxPool) RetryAndRemoveTxs(retryTxs []*commonPb.Transaction, removeTxs []*commonPb.Transaction)
func (*BatchTxPool) SetBatchCreateTimeout ¶
func (p *BatchTxPool) SetBatchCreateTimeout(timeout time.Duration)
func (*BatchTxPool) SetBatchMaxSize ¶
func (p *BatchTxPool) SetBatchMaxSize(size int)
func (*BatchTxPool) SetMsgBus ¶
func (p *BatchTxPool) SetMsgBus(msgBus msgbus.MessageBus)
func (*BatchTxPool) SetPoolSize ¶
func (p *BatchTxPool) SetPoolSize(size int)
func (*BatchTxPool) Start ¶
func (p *BatchTxPool) Start() error
func (*BatchTxPool) Stop ¶
func (p *BatchTxPool) Stop() error
func (*BatchTxPool) TxExists ¶
func (p *BatchTxPool) TxExists(tx *commonPb.Transaction) bool
type Option ¶
type Option func(p *BatchTxPool) error
func WithMsgBus ¶
func WithMsgBus(msgBus msgbus.MessageBus) Option
Click to show internal directories.
Click to hide internal directories.