Documentation
¶
Overview ¶
Package txpool is a generated GoMock package.
Index ¶
- type Config
- type ConfigError
- type FeeConfig
- type InvalidFeeError
- type MockReader
- func (m *MockReader) AllPendingTxs() []*tx.Tx
- func (m *MockReader) EXPECT() *MockReaderMockRecorder
- func (m *MockReader) EstimatedFee(amt amount.Amount, payloadType payload.Type) amount.Amount
- func (m *MockReader) HasTx(txID tx.ID) bool
- func (m *MockReader) PendingTx(txID tx.ID) *tx.Tx
- func (m *MockReader) PrepareBlockTransactions() block.Txs
- func (m *MockReader) Size() int
- type MockReaderMockRecorder
- func (mr *MockReaderMockRecorder) AllPendingTxs() *gomock.Call
- func (mr *MockReaderMockRecorder) EstimatedFee(amt, payloadType any) *gomock.Call
- func (mr *MockReaderMockRecorder) HasTx(txID any) *gomock.Call
- func (mr *MockReaderMockRecorder) PendingTx(txID any) *gomock.Call
- func (mr *MockReaderMockRecorder) PrepareBlockTransactions() *gomock.Call
- func (mr *MockReaderMockRecorder) Size() *gomock.Call
- type MockTxPool
- func (m *MockTxPool) AllPendingTxs() []*tx.Tx
- func (m *MockTxPool) AppendTx(trx *tx.Tx) error
- func (m *MockTxPool) AppendTxAndBroadcast(trx *tx.Tx) error
- func (m *MockTxPool) EXPECT() *MockTxPoolMockRecorder
- func (m *MockTxPool) EstimatedFee(amt amount.Amount, payloadType payload.Type) amount.Amount
- func (m *MockTxPool) HandleCommittedBlock(blk *block.Block)
- func (m *MockTxPool) HasTx(txID tx.ID) bool
- func (m *MockTxPool) PendingTx(txID tx.ID) *tx.Tx
- func (m *MockTxPool) PrepareBlockTransactions() block.Txs
- func (m *MockTxPool) SetNewSandboxAndRecheck(sbx sandbox.Sandbox)
- func (m *MockTxPool) Size() int
- type MockTxPoolMockRecorder
- func (mr *MockTxPoolMockRecorder) AllPendingTxs() *gomock.Call
- func (mr *MockTxPoolMockRecorder) AppendTx(trx any) *gomock.Call
- func (mr *MockTxPoolMockRecorder) AppendTxAndBroadcast(trx any) *gomock.Call
- func (mr *MockTxPoolMockRecorder) EstimatedFee(amt, payloadType any) *gomock.Call
- func (mr *MockTxPoolMockRecorder) HandleCommittedBlock(blk any) *gomock.Call
- func (mr *MockTxPoolMockRecorder) HasTx(txID any) *gomock.Call
- func (mr *MockTxPoolMockRecorder) PendingTx(txID any) *gomock.Call
- func (mr *MockTxPoolMockRecorder) PrepareBlockTransactions() *gomock.Call
- func (mr *MockTxPoolMockRecorder) SetNewSandboxAndRecheck(sbx any) *gomock.Call
- func (mr *MockTxPoolMockRecorder) Size() *gomock.Call
- type Reader
- type TxPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
MaxSize int `toml:"max_size"`
Fee *FeeConfig `toml:"fee"`
// Private configuration
ConsumptionWindow uint32 `toml:"-"`
}
Config defines parameters for the transaction pool.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default transaction pool configuration.
func (*Config) BasicCheck ¶ added in v0.15.0
BasicCheck performs basic checks on the configuration.
type ConfigError ¶ added in v1.1.0
type ConfigError struct {
Reason string
}
ConfigError is returned when the transaction pool configuration is invalid.
func (ConfigError) Error ¶ added in v1.1.0
func (e ConfigError) Error() string
type FeeConfig ¶ added in v1.6.0
type FeeConfig struct {
FixedFee float64 `toml:"fixed_fee"`
DailyLimit int `toml:"daily_limit"`
UnitPrice float64 `toml:"unit_price"`
}
FeeConfig holds fee-related settings used to estimate and validate transaction fees.
func DefaultFeeConfig ¶ added in v1.6.0
func DefaultFeeConfig() *FeeConfig
DefaultFeeConfig returns the default fee configuration.
type InvalidFeeError ¶ added in v1.6.0
InvalidFeeError indicates that a transaction fee is below the required minimum.
func (InvalidFeeError) Error ¶ added in v1.6.0
func (e InvalidFeeError) Error() string
type MockReader ¶ added in v1.14.0
type MockReader struct {
// contains filtered or unexported fields
}
MockReader is a mock of Reader interface.
func NewMockReader ¶ added in v1.14.0
func NewMockReader(ctrl *gomock.Controller) *MockReader
NewMockReader creates a new mock instance.
func (*MockReader) AllPendingTxs ¶ added in v1.14.0
func (m *MockReader) AllPendingTxs() []*tx.Tx
AllPendingTxs mocks base method.
func (*MockReader) EXPECT ¶ added in v1.14.0
func (m *MockReader) EXPECT() *MockReaderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockReader) EstimatedFee ¶ added in v1.14.0
EstimatedFee mocks base method.
func (*MockReader) HasTx ¶ added in v1.14.0
func (m *MockReader) HasTx(txID tx.ID) bool
HasTx mocks base method.
func (*MockReader) PendingTx ¶ added in v1.14.0
func (m *MockReader) PendingTx(txID tx.ID) *tx.Tx
PendingTx mocks base method.
func (*MockReader) PrepareBlockTransactions ¶ added in v1.14.0
func (m *MockReader) PrepareBlockTransactions() block.Txs
PrepareBlockTransactions mocks base method.
type MockReaderMockRecorder ¶ added in v1.14.0
type MockReaderMockRecorder struct {
// contains filtered or unexported fields
}
MockReaderMockRecorder is the mock recorder for MockReader.
func (*MockReaderMockRecorder) AllPendingTxs ¶ added in v1.14.0
func (mr *MockReaderMockRecorder) AllPendingTxs() *gomock.Call
AllPendingTxs indicates an expected call of AllPendingTxs.
func (*MockReaderMockRecorder) EstimatedFee ¶ added in v1.14.0
func (mr *MockReaderMockRecorder) EstimatedFee(amt, payloadType any) *gomock.Call
EstimatedFee indicates an expected call of EstimatedFee.
func (*MockReaderMockRecorder) HasTx ¶ added in v1.14.0
func (mr *MockReaderMockRecorder) HasTx(txID any) *gomock.Call
HasTx indicates an expected call of HasTx.
func (*MockReaderMockRecorder) PendingTx ¶ added in v1.14.0
func (mr *MockReaderMockRecorder) PendingTx(txID any) *gomock.Call
PendingTx indicates an expected call of PendingTx.
func (*MockReaderMockRecorder) PrepareBlockTransactions ¶ added in v1.14.0
func (mr *MockReaderMockRecorder) PrepareBlockTransactions() *gomock.Call
PrepareBlockTransactions indicates an expected call of PrepareBlockTransactions.
func (*MockReaderMockRecorder) Size ¶ added in v1.14.0
func (mr *MockReaderMockRecorder) Size() *gomock.Call
Size indicates an expected call of Size.
type MockTxPool ¶
type MockTxPool struct {
// contains filtered or unexported fields
}
MockTxPool is a mock of TxPool interface.
func NewMockTxPool ¶ added in v1.14.0
func NewMockTxPool(ctrl *gomock.Controller) *MockTxPool
NewMockTxPool creates a new mock instance.
func (*MockTxPool) AllPendingTxs ¶ added in v1.3.0
func (m *MockTxPool) AllPendingTxs() []*tx.Tx
AllPendingTxs mocks base method.
func (*MockTxPool) AppendTx ¶
func (m *MockTxPool) AppendTx(trx *tx.Tx) error
AppendTx mocks base method.
func (*MockTxPool) AppendTxAndBroadcast ¶
func (m *MockTxPool) AppendTxAndBroadcast(trx *tx.Tx) error
AppendTxAndBroadcast mocks base method.
func (*MockTxPool) EXPECT ¶ added in v1.14.0
func (m *MockTxPool) EXPECT() *MockTxPoolMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockTxPool) EstimatedFee ¶ added in v1.1.6
EstimatedFee mocks base method.
func (*MockTxPool) HandleCommittedBlock ¶ added in v1.6.0
func (m *MockTxPool) HandleCommittedBlock(blk *block.Block)
HandleCommittedBlock mocks base method.
func (*MockTxPool) PendingTx ¶
func (m *MockTxPool) PendingTx(txID tx.ID) *tx.Tx
PendingTx mocks base method.
func (*MockTxPool) PrepareBlockTransactions ¶
func (m *MockTxPool) PrepareBlockTransactions() block.Txs
PrepareBlockTransactions mocks base method.
func (*MockTxPool) SetNewSandboxAndRecheck ¶
func (m *MockTxPool) SetNewSandboxAndRecheck(sbx sandbox.Sandbox)
SetNewSandboxAndRecheck mocks base method.
type MockTxPoolMockRecorder ¶ added in v1.14.0
type MockTxPoolMockRecorder struct {
// contains filtered or unexported fields
}
MockTxPoolMockRecorder is the mock recorder for MockTxPool.
func (*MockTxPoolMockRecorder) AllPendingTxs ¶ added in v1.14.0
func (mr *MockTxPoolMockRecorder) AllPendingTxs() *gomock.Call
AllPendingTxs indicates an expected call of AllPendingTxs.
func (*MockTxPoolMockRecorder) AppendTx ¶ added in v1.14.0
func (mr *MockTxPoolMockRecorder) AppendTx(trx any) *gomock.Call
AppendTx indicates an expected call of AppendTx.
func (*MockTxPoolMockRecorder) AppendTxAndBroadcast ¶ added in v1.14.0
func (mr *MockTxPoolMockRecorder) AppendTxAndBroadcast(trx any) *gomock.Call
AppendTxAndBroadcast indicates an expected call of AppendTxAndBroadcast.
func (*MockTxPoolMockRecorder) EstimatedFee ¶ added in v1.14.0
func (mr *MockTxPoolMockRecorder) EstimatedFee(amt, payloadType any) *gomock.Call
EstimatedFee indicates an expected call of EstimatedFee.
func (*MockTxPoolMockRecorder) HandleCommittedBlock ¶ added in v1.14.0
func (mr *MockTxPoolMockRecorder) HandleCommittedBlock(blk any) *gomock.Call
HandleCommittedBlock indicates an expected call of HandleCommittedBlock.
func (*MockTxPoolMockRecorder) HasTx ¶ added in v1.14.0
func (mr *MockTxPoolMockRecorder) HasTx(txID any) *gomock.Call
HasTx indicates an expected call of HasTx.
func (*MockTxPoolMockRecorder) PendingTx ¶ added in v1.14.0
func (mr *MockTxPoolMockRecorder) PendingTx(txID any) *gomock.Call
PendingTx indicates an expected call of PendingTx.
func (*MockTxPoolMockRecorder) PrepareBlockTransactions ¶ added in v1.14.0
func (mr *MockTxPoolMockRecorder) PrepareBlockTransactions() *gomock.Call
PrepareBlockTransactions indicates an expected call of PrepareBlockTransactions.
func (*MockTxPoolMockRecorder) SetNewSandboxAndRecheck ¶ added in v1.14.0
func (mr *MockTxPoolMockRecorder) SetNewSandboxAndRecheck(sbx any) *gomock.Call
SetNewSandboxAndRecheck indicates an expected call of SetNewSandboxAndRecheck.
func (*MockTxPoolMockRecorder) Size ¶ added in v1.14.0
func (mr *MockTxPoolMockRecorder) Size() *gomock.Call
Size indicates an expected call of Size.
type Reader ¶
type Reader interface {
PrepareBlockTransactions() block.Txs
PendingTx(txID tx.ID) *tx.Tx
HasTx(txID tx.ID) bool
Size() int
EstimatedFee(amt amount.Amount, payloadType payload.Type) amount.Amount
AllPendingTxs() []*tx.Tx
}
Reader exposes read-only operations on the transaction pool.
type TxPool ¶
type TxPool interface {
Reader
SetNewSandboxAndRecheck(sbx sandbox.Sandbox)
AppendTxAndBroadcast(trx *tx.Tx) error
AppendTx(trx *tx.Tx) error
HandleCommittedBlock(blk *block.Block)
}
TxPool defines the full transaction pool interface with read and write operations.
func NewTxPool ¶
func NewTxPool(conf *Config, storeReader store.Reader, broadcastPipe pipeline.Pipeline[message.Message], eventPipe pipeline.Pipeline[any], ) TxPool
NewTxPool constructs a new transaction pool with sub-pools per transaction type. The pool also maintains a consumption map for tracking per-address daily byte usage.