Documentation ¶
Index ¶
- Constants
- Variables
- func BTPDigestHashFromResult(result []byte) ([]byte, error)
- func CheckTxTimestamp(min, max int64, tx transaction.Transaction) error
- func DurationToTimestamp(d time.Duration) int64
- func FinalizeTransition(tr module.Transition, opt int, noFlush bool) error
- func Inspect(c module.Chain, informal bool) map[string]interface{}
- func NewBTPContext(dbase db.Database, result []byte) (state.BTPContext, error)
- func NewExecutionResult(p, n module.ReceiptList, vfee, fee *big.Int) base.ExecutionResult
- func NewInitTransition(db db.Database, result []byte, vl module.ValidatorList, ...) (module.Transition, error)
- func NewManager(chain module.Chain, nm module.NetworkManager, eem eeproxy.Manager, ...) (module.ServiceManager, error)
- func NewSyncTransition(tr module.Transition, sm SyncManager, result []byte, vl []byte, noBuffer bool) module.Transition
- func NewTransition(parent module.Transition, patchtxs module.TransactionList, ...) module.Transition
- func NewWorldSnapshot(database db.Database, plt base.Platform, result []byte, ...) (state.WorldSnapshot, error)
- func PatchTransition(tr module.Transition, bi module.BlockInfo, ptxs module.TransactionList) module.Transition
- func TimestampToDuration(t int64) time.Duration
- func TransactionTimestampThreshold(wc state.WorldContext, g module.TransactionGroup) int64
- type Monitor
- type PoolCapacityMonitor
- type QueryHandler
- type SyncManager
- type TXIDLogger
- type TXIDManager
- type TXIDSet
- type TimestampRange
- type TransactionManager
- func (m *TransactionManager) Add(tx transaction.Transaction, direct bool, verified bool) error
- func (m *TransactionManager) AddAndWait(tx transaction.Transaction) (<-chan interface{}, error)
- func (m *TransactionManager) Candidate(g module.TransactionGroup, wc state.WorldContext, maxBytes, maxCount int) ([]module.Transaction, int)
- func (m *TransactionManager) FilterTransactions(g module.TransactionGroup, bloom *TxBloom, max int) []module.Transaction
- func (m *TransactionManager) GetBloomOf(g module.TransactionGroup) *TxBloom
- func (m *TransactionManager) HasTx(id []byte) bool
- func (m *TransactionManager) Logger() log.Logger
- func (m *TransactionManager) NotifyFinalized(l1 module.TransactionList, r1 module.ReceiptList, l2 module.TransactionList, ...)
- func (m *TransactionManager) OnTxDrops(drops []TxDrop)
- func (m *TransactionManager) RemoveOldTxByBlockTS(group module.TransactionGroup, bts int64)
- func (m *TransactionManager) RemoveTxs(g module.TransactionGroup, l module.TransactionList)
- func (m *TransactionManager) SetPoolCapacityMonitor(pcm PoolCapacityMonitor)
- func (m *TransactionManager) VerifyTx(tx transaction.Transaction) error
- func (m *TransactionManager) Wait(wc state.WorldContext, cb func()) bool
- func (m *TransactionManager) WaitResult(id []byte) (<-chan interface{}, error)
- type TransactionPool
- func (tp *TransactionPool) Add(tx transaction.Transaction, direct bool) error
- func (tp *TransactionPool) Candidate(wc state.WorldContext, maxBytes int, maxCount int) ([]module.Transaction, int)
- func (tp *TransactionPool) CheckTxs(wc state.WorldContext) bool
- func (tp *TransactionPool) DropOldTXs(bts int64)
- func (tp *TransactionPool) FilterTransactions(bloom *TxBloom, max int) []module.Transaction
- func (tp *TransactionPool) GetBloom() *TxBloom
- func (tp *TransactionPool) HasTx(tid []byte) bool
- func (tp *TransactionPool) RemoveList(txs module.TransactionList)
- func (tp *TransactionPool) SetPoolCapacityMonitor(pcm PoolCapacityMonitor)
- func (tp *TransactionPool) SetTxManager(txm TxWaiterManager)
- func (tp *TransactionPool) Size() int
- func (tp *TransactionPool) Used() int
- type TransactionReactor
- func (r *TransactionReactor) OnFailure(err error, pi module.ProtocolInfo, b []byte)
- func (r *TransactionReactor) OnJoin(id module.PeerID)
- func (r *TransactionReactor) OnLeave(id module.PeerID)
- func (r *TransactionReactor) OnReceive(subProtocol module.ProtocolInfo, buf []byte, peerId module.PeerID) (bool, error)
- func (r *TransactionReactor) PropagateTransaction(tx transaction.Transaction) error
- func (r *TransactionReactor) Start(wallet module.Wallet)
- func (r *TransactionReactor) Stop()
- type TransactionShare
- func (ts *TransactionShare) EnableTxRequest(yn bool)
- func (ts *TransactionShare) HandleJoin(peer module.PeerID)
- func (ts *TransactionShare) HandleLeave(peer module.PeerID)
- func (ts *TransactionShare) HandleRequestTransaction(buf []byte, peer module.PeerID) (bool, error)
- func (ts *TransactionShare) OnPoolCapacityUpdated(group module.TransactionGroup, size, used int)
- func (ts *TransactionShare) Start(handler module.ProtocolHandler, wallet module.Wallet)
- func (ts *TransactionShare) Stop()
- type TxBloom
- type TxDrop
- type TxTimestampChecker
- type TxWaiterManager
Constants ¶
const ( DuplicateTransactionError errors.Code = iota + errors.CodeService TransactionPoolOverflowError ExpiredTransactionError FutureTransactionError TransitionInterruptedError InvalidTransactionError InvalidQueryError InvalidResultError NoActiveContractError NotContractAddressError InvalidPatchDataError CommittedTransactionError )
const ( LogLevelNone = iota LogLevelMsg LogLevelDebug )
const ( ReactorName = "transaction" ReactorPriority = 4 )
const ( ConfigTXTimestampThresholdDefault = int64(5 * time.Minute / time.Microsecond) ConfigPatchTimestampThreshold = int64(1 * time.Minute / time.Microsecond) )
const ConfigTransitionResultCacheEntryCount = 10
const ConfigTransitionResultCacheEntrySize = 1024 * 1024
const (
ExFlagBTPData = 1 << iota
)
const InvalidHeight = -1
const (
RetryCount = 2
)
Variables ¶
var ( ErrDuplicateTransaction = errors.NewBase(DuplicateTransactionError, "DuplicateTransaction") ErrTransactionPoolOverFlow = errors.NewBase(TransactionPoolOverflowError, "TransactionPoolOverFlow") ErrExpiredTransaction = errors.NewBase(ExpiredTransactionError, "ExpiredTransaction") ErrTransitionInterrupted = errors.NewBase(TransitionInterruptedError, "TransitionInterrupted") ErrInvalidTransaction = errors.NewBase(InvalidTransactionError, "InvalidTransaction") ErrCommittedTransaction = errors.NewBase(CommittedTransactionError, "CommittedTransaction") )
Functions ¶
func BTPDigestHashFromResult ¶ added in v1.3.0
func CheckTxTimestamp ¶
func CheckTxTimestamp(min, max int64, tx transaction.Transaction) error
func DurationToTimestamp ¶
func FinalizeTransition ¶ added in v0.9.6
func FinalizeTransition(tr module.Transition, opt int, noFlush bool) error
FinalizeTransition finalize parts of transition result without updating other information of service manager. It's only for development purpose. So, normally it should not be used.
func NewBTPContext ¶ added in v1.3.0
func NewExecutionResult ¶ added in v0.9.4
func NewExecutionResult(p, n module.ReceiptList, vfee, fee *big.Int) base.ExecutionResult
func NewInitTransition ¶ added in v0.9.6
func NewInitTransition( db db.Database, result []byte, vl module.ValidatorList, cm contract.ContractManager, em eeproxy.Manager, chain module.Chain, logger log.Logger, plt base.Platform, tsc *TxTimestampChecker, ) (module.Transition, error)
NewInitTransition creates initial transition based on the last result. It's only for development purpose. So, normally it should not be used.
func NewManager ¶
func NewSyncTransition ¶ added in v0.9.7
func NewSyncTransition( tr module.Transition, sm SyncManager, result []byte, vl []byte, noBuffer bool, ) module.Transition
func NewTransition ¶ added in v0.9.6
func NewTransition( parent module.Transition, patchtxs module.TransactionList, normaltxs module.TransactionList, bi module.BlockInfo, csi module.ConsensusInfo, alreadyValidated bool, ) module.Transition
NewTransition creates new transition based on the parent to execute given transactions under given environments. It's only for development purpose. So, normally it should not be used.
func NewWorldSnapshot ¶ added in v0.9.6
func NewWorldSnapshot(database db.Database, plt base.Platform, result []byte, vl module.ValidatorList) (state.WorldSnapshot, error)
func PatchTransition ¶ added in v0.9.8
func PatchTransition( tr module.Transition, bi module.BlockInfo, ptxs module.TransactionList, ) module.Transition
func TimestampToDuration ¶
func TransactionTimestampThreshold ¶
func TransactionTimestampThreshold(wc state.WorldContext, g module.TransactionGroup) int64
Types ¶
type PoolCapacityMonitor ¶
type PoolCapacityMonitor interface {
OnPoolCapacityUpdated(group module.TransactionGroup, size, used int)
}
type QueryHandler ¶
type QueryHandler struct {
// contains filtered or unexported fields
}
func NewQueryHandler ¶
func NewQueryHandler(cm contract.ContractManager, to module.Address, data []byte) (*QueryHandler, error)
type SyncManager ¶ added in v0.9.7
type TXIDLogger ¶ added in v1.1.1
type TXIDManager ¶ added in v1.1.1
type TXIDManager interface { OnThresholdChange() HasLocator(id []byte) (bool, error) HasRecent(id []byte) (bool, error) CheckTXForAdd(tx transaction.Transaction) error NewLogger(group module.TransactionGroup, height int64, ts int64) TXIDLogger }
func NewTXIDManager ¶ added in v1.1.1
func NewTXIDManager(dbase db.Database, tsc *TxTimestampChecker) (TXIDManager, error)
type TimestampRange ¶
type TimestampRange interface {
CheckTx(tx transaction.Transaction) error
}
func NewDummyTimeStampRange ¶
func NewDummyTimeStampRange() TimestampRange
func NewTimestampRange ¶
func NewTimestampRange(bts int64, th int64) TimestampRange
func NewTxTimestampRangeFor ¶
func NewTxTimestampRangeFor(c state.WorldContext, g module.TransactionGroup) TimestampRange
type TransactionManager ¶
type TransactionManager struct {
// contains filtered or unexported fields
}
func NewTransactionManager ¶
func NewTransactionManager(nid int, tsc *TxTimestampChecker, ptp *TransactionPool, ntp *TransactionPool, tim TXIDManager, logger log.Logger) *TransactionManager
func (*TransactionManager) Add ¶
func (m *TransactionManager) Add(tx transaction.Transaction, direct bool, verified bool) error
func (*TransactionManager) AddAndWait ¶
func (m *TransactionManager) AddAndWait(tx transaction.Transaction) ( <-chan interface{}, error, )
func (*TransactionManager) Candidate ¶
func (m *TransactionManager) Candidate( g module.TransactionGroup, wc state.WorldContext, maxBytes, maxCount int, ) ([]module.Transaction, int)
func (*TransactionManager) FilterTransactions ¶
func (m *TransactionManager) FilterTransactions(g module.TransactionGroup, bloom *TxBloom, max int) []module.Transaction
func (*TransactionManager) GetBloomOf ¶
func (m *TransactionManager) GetBloomOf(g module.TransactionGroup) *TxBloom
func (*TransactionManager) HasTx ¶
func (m *TransactionManager) HasTx(id []byte) bool
func (*TransactionManager) Logger ¶
func (m *TransactionManager) Logger() log.Logger
func (*TransactionManager) NotifyFinalized ¶
func (m *TransactionManager) NotifyFinalized( l1 module.TransactionList, r1 module.ReceiptList, l2 module.TransactionList, r2 module.ReceiptList, )
func (*TransactionManager) OnTxDrops ¶
func (m *TransactionManager) OnTxDrops(drops []TxDrop)
func (*TransactionManager) RemoveOldTxByBlockTS ¶
func (m *TransactionManager) RemoveOldTxByBlockTS(group module.TransactionGroup, bts int64)
func (*TransactionManager) RemoveTxs ¶
func (m *TransactionManager) RemoveTxs( g module.TransactionGroup, l module.TransactionList, )
func (*TransactionManager) SetPoolCapacityMonitor ¶
func (m *TransactionManager) SetPoolCapacityMonitor(pcm PoolCapacityMonitor)
func (*TransactionManager) VerifyTx ¶ added in v1.1.1
func (m *TransactionManager) VerifyTx(tx transaction.Transaction) error
func (*TransactionManager) Wait ¶
func (m *TransactionManager) Wait(wc state.WorldContext, cb func()) bool
func (*TransactionManager) WaitResult ¶
func (m *TransactionManager) WaitResult(id []byte) (<-chan interface{}, error)
type TransactionPool ¶
type TransactionPool struct {
// contains filtered or unexported fields
}
func NewTransactionPool ¶
func NewTransactionPool(group module.TransactionGroup, size int, tim TXIDManager, m Monitor, log log.Logger) *TransactionPool
func (*TransactionPool) Add ¶
func (tp *TransactionPool) Add(tx transaction.Transaction, direct bool) error
return nil if tx is nil or tx is added to pool return ErrTransactionPoolOverFlow if pool is full
func (*TransactionPool) Candidate ¶
func (tp *TransactionPool) Candidate(wc state.WorldContext, maxBytes int, maxCount int) ( []module.Transaction, int, )
It returns all candidates for a negative integer n.
func (*TransactionPool) CheckTxs ¶
func (tp *TransactionPool) CheckTxs(wc state.WorldContext) bool
func (*TransactionPool) DropOldTXs ¶
func (tp *TransactionPool) DropOldTXs(bts int64)
func (*TransactionPool) FilterTransactions ¶
func (tp *TransactionPool) FilterTransactions(bloom *TxBloom, max int) []module.Transaction
func (*TransactionPool) GetBloom ¶
func (tp *TransactionPool) GetBloom() *TxBloom
func (*TransactionPool) HasTx ¶
func (tp *TransactionPool) HasTx(tid []byte) bool
func (*TransactionPool) RemoveList ¶
func (tp *TransactionPool) RemoveList(txs module.TransactionList)
removeList remove transactions when transactions are finalized.
func (*TransactionPool) SetPoolCapacityMonitor ¶
func (tp *TransactionPool) SetPoolCapacityMonitor(pcm PoolCapacityMonitor)
func (*TransactionPool) SetTxManager ¶
func (tp *TransactionPool) SetTxManager(txm TxWaiterManager)
func (*TransactionPool) Size ¶
func (tp *TransactionPool) Size() int
func (*TransactionPool) Used ¶
func (tp *TransactionPool) Used() int
type TransactionReactor ¶
type TransactionReactor struct {
// contains filtered or unexported fields
}
func NewTransactionReactor ¶
func NewTransactionReactor(nm module.NetworkManager, tm *TransactionManager) *TransactionReactor
func (*TransactionReactor) OnFailure ¶
func (r *TransactionReactor) OnFailure(err error, pi module.ProtocolInfo, b []byte)
func (*TransactionReactor) OnJoin ¶
func (r *TransactionReactor) OnJoin(id module.PeerID)
func (*TransactionReactor) OnLeave ¶
func (r *TransactionReactor) OnLeave(id module.PeerID)
func (*TransactionReactor) OnReceive ¶
func (r *TransactionReactor) OnReceive(subProtocol module.ProtocolInfo, buf []byte, peerId module.PeerID) (bool, error)
func (*TransactionReactor) PropagateTransaction ¶
func (r *TransactionReactor) PropagateTransaction(tx transaction.Transaction) error
func (*TransactionReactor) Start ¶
func (r *TransactionReactor) Start(wallet module.Wallet)
func (*TransactionReactor) Stop ¶
func (r *TransactionReactor) Stop()
type TransactionShare ¶
type TransactionShare struct {
// contains filtered or unexported fields
}
func NewTransactionShare ¶
func NewTransactionShare(tm *TransactionManager) *TransactionShare
func (*TransactionShare) EnableTxRequest ¶
func (ts *TransactionShare) EnableTxRequest(yn bool)
func (*TransactionShare) HandleJoin ¶
func (ts *TransactionShare) HandleJoin(peer module.PeerID)
func (*TransactionShare) HandleLeave ¶
func (ts *TransactionShare) HandleLeave(peer module.PeerID)
func (*TransactionShare) HandleRequestTransaction ¶
func (*TransactionShare) OnPoolCapacityUpdated ¶
func (ts *TransactionShare) OnPoolCapacityUpdated(group module.TransactionGroup, size, used int)
func (*TransactionShare) Start ¶
func (ts *TransactionShare) Start(handler module.ProtocolHandler, wallet module.Wallet)
func (*TransactionShare) Stop ¶
func (ts *TransactionShare) Stop()
type TxBloom ¶
func (*TxBloom) ContainsAllOf ¶
type TxTimestampChecker ¶
type TxTimestampChecker struct {
// contains filtered or unexported fields
}
func NewTimestampChecker ¶
func NewTimestampChecker() *TxTimestampChecker
func (*TxTimestampChecker) CheckWithCurrent ¶
func (c *TxTimestampChecker) CheckWithCurrent(min int64, tx transaction.Transaction) error
func (*TxTimestampChecker) SetThreshold ¶
func (c *TxTimestampChecker) SetThreshold(d time.Duration)
func (*TxTimestampChecker) Threshold ¶
func (c *TxTimestampChecker) Threshold() int64
func (*TxTimestampChecker) TransactionThreshold ¶
func (c *TxTimestampChecker) TransactionThreshold(group module.TransactionGroup) int64
type TxWaiterManager ¶
type TxWaiterManager interface {
OnTxDrops([]TxDrop)
}
Source Files ¶
- databaseadaptor.go
- error.go
- executionresult.go
- inspect.go
- log.go
- manager.go
- memberlist.go
- queryhandler.go
- transactionlist.go
- transactionmanager.go
- transactionpool.go
- transactionreactor.go
- transition.go
- transition_pe.go
- transition_se.go
- transitionresult.go
- transitionresultcache.go
- tschecker.go
- txidmanager.go
- txshare.go