txspool

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2019 License: GPL-3.0, GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package txspool is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidSender is returned if the transaction contains an invalid signature.
	ErrInvalidSender = errors.New("invalid sender")

	// ErrNonceTooLow is returned if the nonce of a transaction is lower than the
	// one present in the local chain.
	ErrNonceTooLow = errors.New("nonce too low")

	// ErrTxFeeTooLow is returned if a transaction's tx_fee is below the value of TXFEE.
	ErrTxFeeTooLow = errors.New("txfee too low")

	// ErrUnderpriced is returned if a transaction's gas price is below the minimum
	// configured for the transaction pool.
	ErrUnderpriced = errors.New("transaction underpriced")

	// ErrReplaceUnderpriced is returned if a transaction is attempted to be replaced
	// with a different one without the required price bump.
	ErrReplaceUnderpriced = errors.New("replacement transaction underpriced")

	// ErrInsufficientFunds is returned if the total cost of executing a transaction
	// is higher than the balance of the user's account.
	ErrInsufficientFunds = errors.New("insufficient funds for gas * price + value")

	// ErrNegativeValue is a sanity error to ensure noone is able to specify a
	// transaction with a negative value.
	ErrNegativeValue = errors.New("negative value")

	// ErrOversizedData is returned if the input data of a transaction is greater
	// than some meaningful limit a user might use. This is not a consensus error
	// making the transaction invalid, rather a DOS protection.
	ErrOversizedData = errors.New("oversized data")
)
View Source
var DefaultTxPoolConfig = TxPoolConfig{
	NoLocals:  false,
	Journal:   "transactions.rlp",
	Rejournal: time.Hour,

	FeeLimit:  1,
	PriceBump: 10,

	GlobalSlots: 48192,
	GlobalQueue: 12048,

	Lifetime:        3 * time.Hour,
	Removetime:      30 * time.Minute,
	OrphanTTL:       20 * time.Minute,
	MaxOrphanTxs:    10000,
	MaxOrphanTxSize: 2000000,
}

DefaultTxPoolConfig contains the default configurations for the transaction pool.

Functions

func CheckTransactionSanity

func CheckTransactionSanity(tx *modules.Transaction) error

func IsCoinBase

func IsCoinBase(tx *modules.Transaction) bool

func PooltxToTx

func PooltxToTx(pooltx *modules.TxPoolTransaction) *modules.Transaction

func TxtoTxpoolTx

func TxtoTxpoolTx(tx *modules.Transaction) *modules.TxPoolTransaction

交易池缓存时需要将tx转化为PoolTx

Types

type ErrorCode

type ErrorCode uint8

ErrorCode identifies a kind of error.

type ITxPool

type ITxPool interface {
	Stop()

	AddLocal(tx *modules.Transaction) error
	AddLocals(txs []*modules.Transaction) []error
	AddSequenTx(tx *modules.Transaction) error
	AddSequenTxs(txs []*modules.Transaction) error
	AllHashs() []*common.Hash
	AllTxpoolTxs() map[common.Hash]*modules.TxPoolTransaction

	// AddRemotes should add the given transactions to the pool.
	AddRemote(tx *modules.Transaction) error
	AddRemotes([]*modules.Transaction) []error
	ProcessTransaction(tx *modules.Transaction, allowOrphan bool, rateLimit bool, tag Tag) ([]*TxDesc, error)

	Pending() (map[common.Hash][]*modules.TxPoolTransaction, error)
	Queued() ([]*modules.TxPoolTransaction, error)
	SetPendingTxs(unit_hash common.Hash, num uint64, txs []*modules.Transaction) error
	ResetPendingTxs(txs []*modules.Transaction) error
	SendStoredTxs(hashs []common.Hash) error
	DiscardTxs(hashs []common.Hash) error
	GetUtxoEntry(outpoint *modules.OutPoint) (*modules.Utxo, error)

	SubscribeTxPreEvent(chan<- modules.TxPreEvent) event.Subscription
	GetSortedTxs(hash common.Hash, index uint64) ([]*modules.TxPoolTransaction, common.StorageSize)
	Get(hash common.Hash) (*modules.TxPoolTransaction, common.Hash)
	GetPoolTxsByAddr(addr string) ([]*modules.TxPoolTransaction, error)
	Stats() (int, int, int)
	Content() (map[common.Hash]*modules.TxPoolTransaction, map[common.Hash]*modules.TxPoolTransaction)
	GetTxFee(tx *modules.Transaction) (*modules.AmountAsset, error)
	OutPointIsSpend(outPoint *modules.OutPoint) (bool, error)
	ValidateOrphanTx(tx *modules.Transaction) (bool, error)
}

type MockITxPool

type MockITxPool struct {
	// contains filtered or unexported fields
}

MockITxPool is a mock of ITxPool interface

func NewMockITxPool

func NewMockITxPool(ctrl *gomock.Controller) *MockITxPool

NewMockITxPool creates a new mock instance

func (*MockITxPool) AddLocal

func (m *MockITxPool) AddLocal(tx *modules.Transaction) error

AddLocal mocks base method

func (*MockITxPool) AddLocals

func (m *MockITxPool) AddLocals(txs []*modules.Transaction) []error

AddLocals mocks base method

func (*MockITxPool) AddRemote

func (m *MockITxPool) AddRemote(tx *modules.Transaction) error

AddRemote mocks base method

func (*MockITxPool) AddRemotes

func (m *MockITxPool) AddRemotes(arg0 []*modules.Transaction) []error

AddRemotes mocks base method

func (*MockITxPool) AddSequenTx

func (m *MockITxPool) AddSequenTx(tx *modules.Transaction) error

AddSequenTx mocks base method

func (*MockITxPool) AddSequenTxs

func (m *MockITxPool) AddSequenTxs(txs []*modules.Transaction) error

AddSequenTxs mocks base method

func (*MockITxPool) AllHashs

func (m *MockITxPool) AllHashs() []*common.Hash

AllHashs mocks base method

func (*MockITxPool) AllTxpoolTxs

func (m *MockITxPool) AllTxpoolTxs() map[common.Hash]*modules.TxPoolTransaction

AllTxpoolTxs mocks base method

func (*MockITxPool) Content

Content mocks base method

func (*MockITxPool) DiscardTxs

func (m *MockITxPool) DiscardTxs(hashs []common.Hash) error

DiscardTxs mocks base method

func (*MockITxPool) EXPECT

func (m *MockITxPool) EXPECT() *MockITxPoolMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockITxPool) Get

Get mocks base method

func (*MockITxPool) GetPoolTxsByAddr

func (m *MockITxPool) GetPoolTxsByAddr(addr string) ([]*modules.TxPoolTransaction, error)

GetPoolTxsByAddr mocks base method

func (*MockITxPool) GetSortedTxs

func (m *MockITxPool) GetSortedTxs(hash common.Hash, index uint64) ([]*modules.TxPoolTransaction, common.StorageSize)

GetSortedTxs mocks base method

func (*MockITxPool) GetTxFee

func (m *MockITxPool) GetTxFee(tx *modules.Transaction) (*modules.AmountAsset, error)

GetTxFee mocks base method

func (*MockITxPool) GetUtxoEntry

func (m *MockITxPool) GetUtxoEntry(outpoint *modules.OutPoint) (*modules.Utxo, error)

GetUtxoEntry mocks base method

func (*MockITxPool) OutPointIsSpend

func (m *MockITxPool) OutPointIsSpend(outPoint *modules.OutPoint) (bool, error)

OutPointIsSpend mocks base method

func (*MockITxPool) Pending

func (m *MockITxPool) Pending() (map[common.Hash][]*modules.TxPoolTransaction, error)

Pending mocks base method

func (*MockITxPool) ProcessTransaction

func (m *MockITxPool) ProcessTransaction(tx *modules.Transaction, allowOrphan, rateLimit bool, tag Tag) ([]*TxDesc, error)

ProcessTransaction mocks base method

func (*MockITxPool) Queued

func (m *MockITxPool) Queued() ([]*modules.TxPoolTransaction, error)

Queued mocks base method

func (*MockITxPool) ResetPendingTxs

func (m *MockITxPool) ResetPendingTxs(txs []*modules.Transaction) error

ResetPendingTxs mocks base method

func (*MockITxPool) SendStoredTxs

func (m *MockITxPool) SendStoredTxs(hashs []common.Hash) error

SendStoredTxs mocks base method

func (*MockITxPool) SetPendingTxs

func (m *MockITxPool) SetPendingTxs(unit_hash common.Hash, num uint64, txs []*modules.Transaction) error

SetPendingTxs mocks base method

func (*MockITxPool) Stats

func (m *MockITxPool) Stats() (int, int, int)

Stats mocks base method

func (*MockITxPool) Stop

func (m *MockITxPool) Stop()

Stop mocks base method

func (*MockITxPool) SubscribeTxPreEvent

func (m *MockITxPool) SubscribeTxPreEvent(arg0 chan<- modules.TxPreEvent) event.Subscription

SubscribeTxPreEvent mocks base method

func (*MockITxPool) ValidateOrphanTx

func (m *MockITxPool) ValidateOrphanTx(tx *modules.Transaction) (bool, error)

ValidateOrphanTx mocks base method

type MockITxPoolMockRecorder

type MockITxPoolMockRecorder struct {
	// contains filtered or unexported fields
}

MockITxPoolMockRecorder is the mock recorder for MockITxPool

func (*MockITxPoolMockRecorder) AddLocal

func (mr *MockITxPoolMockRecorder) AddLocal(tx interface{}) *gomock.Call

AddLocal indicates an expected call of AddLocal

func (*MockITxPoolMockRecorder) AddLocals

func (mr *MockITxPoolMockRecorder) AddLocals(txs interface{}) *gomock.Call

AddLocals indicates an expected call of AddLocals

func (*MockITxPoolMockRecorder) AddRemote

func (mr *MockITxPoolMockRecorder) AddRemote(tx interface{}) *gomock.Call

AddRemote indicates an expected call of AddRemote

func (*MockITxPoolMockRecorder) AddRemotes

func (mr *MockITxPoolMockRecorder) AddRemotes(arg0 interface{}) *gomock.Call

AddRemotes indicates an expected call of AddRemotes

func (*MockITxPoolMockRecorder) AddSequenTx

func (mr *MockITxPoolMockRecorder) AddSequenTx(tx interface{}) *gomock.Call

AddSequenTx indicates an expected call of AddSequenTx

func (*MockITxPoolMockRecorder) AddSequenTxs

func (mr *MockITxPoolMockRecorder) AddSequenTxs(txs interface{}) *gomock.Call

AddSequenTxs indicates an expected call of AddSequenTxs

func (*MockITxPoolMockRecorder) AllHashs

func (mr *MockITxPoolMockRecorder) AllHashs() *gomock.Call

AllHashs indicates an expected call of AllHashs

func (*MockITxPoolMockRecorder) AllTxpoolTxs

func (mr *MockITxPoolMockRecorder) AllTxpoolTxs() *gomock.Call

AllTxpoolTxs indicates an expected call of AllTxpoolTxs

func (*MockITxPoolMockRecorder) Content

func (mr *MockITxPoolMockRecorder) Content() *gomock.Call

Content indicates an expected call of Content

func (*MockITxPoolMockRecorder) DiscardTxs

func (mr *MockITxPoolMockRecorder) DiscardTxs(hashs interface{}) *gomock.Call

DiscardTxs indicates an expected call of DiscardTxs

func (*MockITxPoolMockRecorder) Get

func (mr *MockITxPoolMockRecorder) Get(hash interface{}) *gomock.Call

Get indicates an expected call of Get

func (*MockITxPoolMockRecorder) GetPoolTxsByAddr

func (mr *MockITxPoolMockRecorder) GetPoolTxsByAddr(addr interface{}) *gomock.Call

GetPoolTxsByAddr indicates an expected call of GetPoolTxsByAddr

func (*MockITxPoolMockRecorder) GetSortedTxs

func (mr *MockITxPoolMockRecorder) GetSortedTxs(hash, index interface{}) *gomock.Call

GetSortedTxs indicates an expected call of GetSortedTxs

func (*MockITxPoolMockRecorder) GetTxFee

func (mr *MockITxPoolMockRecorder) GetTxFee(tx interface{}) *gomock.Call

GetTxFee indicates an expected call of GetTxFee

func (*MockITxPoolMockRecorder) GetUtxoEntry

func (mr *MockITxPoolMockRecorder) GetUtxoEntry(outpoint interface{}) *gomock.Call

GetUtxoEntry indicates an expected call of GetUtxoEntry

func (*MockITxPoolMockRecorder) OutPointIsSpend

func (mr *MockITxPoolMockRecorder) OutPointIsSpend(outPoint interface{}) *gomock.Call

OutPointIsSpend indicates an expected call of OutPointIsSpend

func (*MockITxPoolMockRecorder) Pending

func (mr *MockITxPoolMockRecorder) Pending() *gomock.Call

Pending indicates an expected call of Pending

func (*MockITxPoolMockRecorder) ProcessTransaction

func (mr *MockITxPoolMockRecorder) ProcessTransaction(tx, allowOrphan, rateLimit, tag interface{}) *gomock.Call

ProcessTransaction indicates an expected call of ProcessTransaction

func (*MockITxPoolMockRecorder) Queued

func (mr *MockITxPoolMockRecorder) Queued() *gomock.Call

Queued indicates an expected call of Queued

func (*MockITxPoolMockRecorder) ResetPendingTxs

func (mr *MockITxPoolMockRecorder) ResetPendingTxs(txs interface{}) *gomock.Call

ResetPendingTxs indicates an expected call of ResetPendingTxs

func (*MockITxPoolMockRecorder) SendStoredTxs

func (mr *MockITxPoolMockRecorder) SendStoredTxs(hashs interface{}) *gomock.Call

SendStoredTxs indicates an expected call of SendStoredTxs

func (*MockITxPoolMockRecorder) SetPendingTxs

func (mr *MockITxPoolMockRecorder) SetPendingTxs(unit_hash, num, txs interface{}) *gomock.Call

SetPendingTxs indicates an expected call of SetPendingTxs

func (*MockITxPoolMockRecorder) Stats

func (mr *MockITxPoolMockRecorder) Stats() *gomock.Call

Stats indicates an expected call of Stats

func (*MockITxPoolMockRecorder) Stop

func (mr *MockITxPoolMockRecorder) Stop() *gomock.Call

Stop indicates an expected call of Stop

func (*MockITxPoolMockRecorder) SubscribeTxPreEvent

func (mr *MockITxPoolMockRecorder) SubscribeTxPreEvent(arg0 interface{}) *gomock.Call

SubscribeTxPreEvent indicates an expected call of SubscribeTxPreEvent

func (*MockITxPoolMockRecorder) ValidateOrphanTx

func (mr *MockITxPoolMockRecorder) ValidateOrphanTx(tx interface{}) *gomock.Call

ValidateOrphanTx indicates an expected call of ValidateOrphanTx

type RejectCode

type RejectCode uint8
const (
	RejectMalformed       RejectCode = 0x01
	RejectInvalid         RejectCode = 0x10
	RejectObsolete        RejectCode = 0x11
	RejectDuplicate       RejectCode = 0x12
	RejectNonstandard     RejectCode = 0x40
	RejectDust            RejectCode = 0x41
	RejectInsufficientFee RejectCode = 0x42
	RejectCheckpoint      RejectCode = 0x43
)

These constants define the various supported reject codes.

type RuleError

type RuleError struct {
	ErrorCode   RejectCode // Describes the kind of error
	Description string     // Human readable description of the issue
}

RuleError identifies a rule violation. It is used to indicate that processing of a block or transaction failed due to one of the many validation rules. The caller can use type assertions to determine if a failure was specifically due to a rule violation and access the ErrorCode field to ascertain the specific reason for the rule violation.

type RuleError struct {
	ErrorCode   ErrorCode // Describes the kind of error
	Description string    // Human readable description of the issue
}

type Tag

type Tag uint64

type TxDesc

type TxDesc struct {

	// StartingPriority is the priority of the transaction when it was added
	// to the pool.
	StartingPriority float64
	// contains filtered or unexported fields
}

TxDesc is a descriptor containing a transaction in the mempool along with additional metadata.

type TxPool

type TxPool struct {
	// contains filtered or unexported fields
}

func NewTxPool

func NewTxPool(config TxPoolConfig, cachedb palletcache.ICache, unit dags, tokenEngine tokenengine.ITokenEngine) *TxPool

NewTxPool creates a new transaction pool to gather, sort and filter inbound transactions from the network.

func (*TxPool) AddLocal

func (pool *TxPool) AddLocal(tx *modules.Transaction) error

AddLocal enqueues a single transaction into the pool if it is valid, marking the sender as a local one in the mean time, ensuring it goes around the local pricing constraints.

func (*TxPool) AddLocals

func (pool *TxPool) AddLocals(txs []*modules.Transaction) []error

AddLocals enqueues a batch of transactions into the pool if they are valid, marking the senders as a local ones in the mean time, ensuring they go around the local pricing constraints.

func (*TxPool) AddRemote

func (pool *TxPool) AddRemote(tx *modules.Transaction) error

AddRemote enqueues a single transaction into the pool if it is valid. If the sender is not among the locally tracked ones, full pricing constraints will apply.

func (*TxPool) AddRemotes

func (pool *TxPool) AddRemotes(txs []*modules.Transaction) []error

AddRemotes enqueues a batch of transactions into the pool if they are valid. If the senders are not among the locally tracked ones, full pricing constraints will apply.

func (*TxPool) AddSequenTx

func (pool *TxPool) AddSequenTx(tx *modules.Transaction) error

func (*TxPool) AddSequenTxs

func (pool *TxPool) AddSequenTxs(txs []*modules.Transaction) error

func (*TxPool) AllHashs

func (pool *TxPool) AllHashs() []*common.Hash

AllHashs returns a slice of hashes for all of the transactions in the txpool.

func (*TxPool) AllLength

func (pool *TxPool) AllLength() int

func (*TxPool) AllOrphanTxs

func (pool *TxPool) AllOrphanTxs() map[common.Hash]*modules.TxPoolTransaction

func (*TxPool) AllTxpoolTxs

func (pool *TxPool) AllTxpoolTxs() map[common.Hash]*modules.TxPoolTransaction

func (*TxPool) AllTxs

func (pool *TxPool) AllTxs() []*modules.Transaction

func (*TxPool) CheckSpend

func (pool *TxPool) CheckSpend(output modules.OutPoint) *modules.Transaction

CheckSpend checks whether the passed outpoint is already spent by a transaction in the txpool

func (*TxPool) Content

Content retrieves the data content of the transaction pool, returning all the pending as well as queued transactions, grouped by account and sorted by nonce.

func (*TxPool) Count

func (pool *TxPool) Count() int

func (*TxPool) DeleteTx

func (pool *TxPool) DeleteTx() error

DeleteTx

func (*TxPool) DeleteTxByHash

func (pool *TxPool) DeleteTxByHash(hash common.Hash) error

func (*TxPool) DiscardTx

func (pool *TxPool) DiscardTx(hash common.Hash) error

func (*TxPool) DiscardTxs

func (pool *TxPool) DiscardTxs(hashs []common.Hash) error

打包后的没有被最终确认的交易,废弃处理

func (*TxPool) FetchInputUtxos

func (pool *TxPool) FetchInputUtxos(tx *modules.Transaction) (*UtxoViewpoint, error)

func (*TxPool) Get

func (pool *TxPool) Get(hash common.Hash) (*modules.TxPoolTransaction, common.Hash)

Get returns a transaction if it is contained in the pool and nil otherwise.

func (*TxPool) GetPoolTxsByAddr

func (pool *TxPool) GetPoolTxsByAddr(addr string) ([]*modules.TxPoolTransaction, error)

GetPoolTxsByAddr returns all tx by addr.

func (*TxPool) GetSequenTxs

func (pool *TxPool) GetSequenTxs() []*modules.TxPoolTransaction

func (*TxPool) GetSortedTxs

func (pool *TxPool) GetSortedTxs(hash common.Hash, index uint64) ([]*modules.TxPoolTransaction, common.StorageSize)

***** end utxoSet **** GetSortedTxs returns 根据优先级返回list

func (*TxPool) GetStxoEntry added in v1.0.1

func (pool *TxPool) GetStxoEntry(outpoint *modules.OutPoint) (*modules.Stxo, error)

return a stxo by the outpoint in txpool

func (*TxPool) GetTxFee

func (pool *TxPool) GetTxFee(tx *modules.Transaction) (*modules.AmountAsset, error)

func (*TxPool) GetUtxoEntry

func (pool *TxPool) GetUtxoEntry(outpoint *modules.OutPoint) (*modules.Utxo, error)

return a utxo by the outpoint in txpool

func (*TxPool) GetUtxoView

func (pool *TxPool) GetUtxoView(tx *modules.Transaction) (*UtxoViewpoint, error)

func (*TxPool) IsOrphanInPool

func (pool *TxPool) IsOrphanInPool(hash common.Hash) bool

func (*TxPool) IsTransactionInPool

func (pool *TxPool) IsTransactionInPool(hash common.Hash) bool

IsTransactionInPool returns whether or not the passed transaction already exists in the main pool.

func (*TxPool) OutPointIsSpend

func (pool *TxPool) OutPointIsSpend(outPoint *modules.OutPoint) (bool, error)

func (*TxPool) Pending

func (pool *TxPool) Pending() (map[common.Hash][]*modules.TxPoolTransaction, error)

Pending retrieves all currently processable transactions, groupped by origin account and sorted by priority level. The returned transaction set is a copy and can be freely modified by calling code.

func (*TxPool) ProcessTransaction

func (pool *TxPool) ProcessTransaction(tx *modules.Transaction, allowOrphan bool, rateLimit bool,
	tag Tag) ([]*TxDesc, error)

func (*TxPool) Queued

func (pool *TxPool) Queued() ([]*modules.TxPoolTransaction, error)

Queued txs

func (*TxPool) RemoveDoubleSpends

func (pool *TxPool) RemoveDoubleSpends(tx *modules.Transaction)

RemoveDoubleSpends removes all transactions whitch spend outpoints spent by the passed transaction from the memory pool. Removing those transactions then leads to removing all transaction whitch rely on them, recursively. This is necessary when a blocks is connected to the main chain because the block may contain transactions whitch were previously unknow to the memory pool.

func (*TxPool) RemoveOrphan

func (pool *TxPool) RemoveOrphan(tx *modules.TxPoolTransaction)

This function is safe for concurrent access.

func (*TxPool) RemoveTransaction

func (pool *TxPool) RemoveTransaction(hash common.Hash, removeRedeemers bool)

func (*TxPool) RemoveTxs

func (pool *TxPool) RemoveTxs(hashs []common.Hash)

func (*TxPool) ResetPendingTxs

func (pool *TxPool) ResetPendingTxs(txs []*modules.Transaction) error

func (*TxPool) SendStoredTxs

func (pool *TxPool) SendStoredTxs(hashs []common.Hash) error

func (*TxPool) SetPendingTxs

func (pool *TxPool) SetPendingTxs(unit_hash common.Hash, num uint64, txs []*modules.Transaction) error

func (*TxPool) Stats

func (pool *TxPool) Stats() (int, int, int)

Stats retrieves the current pool stats, namely the number of pending and the number of queued (non-executable) transactions.

func (*TxPool) Status

func (pool *TxPool) Status(hashes []common.Hash) []TxStatus

Status returns the status (unknown/pending/queued) of a batch of transactions identified by their hashes.

func (*TxPool) Stop

func (pool *TxPool) Stop()

Stop terminates the transaction pool.

func (*TxPool) SubscribeTxPreEvent

func (pool *TxPool) SubscribeTxPreEvent(ch chan<- modules.TxPreEvent) event.Subscription

SubscribeTxPreEvent registers a subscription of TxPreEvent and starts sending event to the given channel.

func (*TxPool) ValidateOrphanTx

func (pool *TxPool) ValidateOrphanTx(tx *modules.Transaction) (bool, error)

validate tx is an orphanTx or not.

type TxPoolConfig

type TxPoolConfig struct {
	NoLocals  bool          // Whether local transaction handling should be disabled
	Journal   string        // Journal of local transactions to survive node restarts
	Rejournal time.Duration // Time interval to regenerate the local transaction journal

	FeeLimit  uint64 // Minimum tx's fee  to enforce for acceptance into the pool
	PriceBump uint64 // Minimum price bump percentage to replace an already existing transaction (nonce)

	GlobalSlots uint64 // Maximum number of executable transaction slots for all accounts
	GlobalQueue uint64 // Maximum number of non-executable transaction slots for all accounts

	Lifetime   time.Duration // Maximum amount of time non-executable transaction are queued
	Removetime time.Duration // Maximum amount of time txpool transaction are removed
	OrphanTTL  time.Duration // Orpthan expiration
	// MaxOrphanTxs is the maximum number of orphan transactions
	// that can be queued.
	MaxOrphanTxs int

	// MaxOrphanTxSize is the maximum size allowed for orphan transactions.
	// This helps prevent memory exhaustion attacks from sending a lot of
	// of big orphans.
	MaxOrphanTxSize int
}

TxPoolConfig are the configuration parameters of the transaction pool.

type TxRuleError

type TxRuleError struct {
	RejectCode  RejectCode // The code to send with reject messages
	Description string     // Human readable description of the issue
}

TxRuleError identifies a rule violation. It is used to indicate that processing of a transaction failed due to one of the many validation rules. The caller can use type assertions to determine if a failure was specifically due to a rule violation and access the ErrorCode field to ascertain the specific reason for the rule violation.

type TxStatus

type TxStatus uint
const (
	TxStatusNotIncluded TxStatus = iota
	TxStatusIncluded
	TxStatusQueued
	TxStatusPending
	TxStatusConfirmed
	TxStatusUnKnow
)

type UtxoViewpoint

type UtxoViewpoint struct {
	// contains filtered or unexported fields
}

UtxoViewpoint

func NewUtxoViewpoint

func NewUtxoViewpoint() *UtxoViewpoint

func (*UtxoViewpoint) AddTxOut

func (view *UtxoViewpoint) AddTxOut(tx *modules.Transaction, msgIdx, txoutIdx uint32)

func (*UtxoViewpoint) AddTxOuts

func (view *UtxoViewpoint) AddTxOuts(tx *modules.Transaction)

func (*UtxoViewpoint) AddUtxo

func (view *UtxoViewpoint) AddUtxo(key modules.OutPoint, utxo *modules.Utxo)

func (*UtxoViewpoint) BestHash

func (view *UtxoViewpoint) BestHash() *common.Hash

func (*UtxoViewpoint) Entries

func (view *UtxoViewpoint) Entries() map[modules.OutPoint]*modules.Utxo

func (*UtxoViewpoint) FetchUnitUtxos

func (view *UtxoViewpoint) FetchUnitUtxos(db utxoBaseGetOp, unit *modules.Unit) error

func (*UtxoViewpoint) FetchUtxos

func (view *UtxoViewpoint) FetchUtxos(db utxoBaseGetOp, outpoints map[modules.OutPoint]struct{}) error

func (*UtxoViewpoint) LookupUtxo

func (view *UtxoViewpoint) LookupUtxo(outpoint modules.OutPoint) *modules.Utxo

func (*UtxoViewpoint) RemoveUtxo

func (view *UtxoViewpoint) RemoveUtxo(outpoint modules.OutPoint)

func (*UtxoViewpoint) SetBestHash

func (view *UtxoViewpoint) SetBestHash(hash *common.Hash)

func (*UtxoViewpoint) SetEntries

func (view *UtxoViewpoint) SetEntries(key modules.OutPoint, utxo *modules.Utxo)

func (*UtxoViewpoint) SpentUtxo

func (view *UtxoViewpoint) SpentUtxo(db utxoBaseOp, outpoints map[modules.OutPoint]struct{}) error

Jump to

Keyboard shortcuts

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