Documentation
¶
Index ¶
- Constants
- Variables
- func CreateTransactionPoolActor(level tplogcmm.LogLevel, log tplog.Logger, sysActor *actor.ActorSystem, ...) (*actor.PID, error)
- func NewTransactionPool(exeDomainID string, nodeID string, ctx context.Context, ...) txpooli.TransactionPool
- func NewTransactionPoolHandler(log tplog.Logger, txPool *transactionPool, txMsgSub TxMsgSubProcessor) *transactionPoolHandler
- type BlockAddedEvent
- type BlocksRevertEvent
- type PickTxType
- type TransactionPoolHandler
- type TransactionPoolServant
- type TxExpiredPolicy
- type TxMessage
- func (*TxMessage) Descriptor() ([]byte, []int)
- func (m *TxMessage) GetData() []byte
- func (m *TxMessage) Marshal() (dAtA []byte, err error)
- func (m *TxMessage) MarshalTo(dAtA []byte) (int, error)
- func (m *TxMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*TxMessage) ProtoMessage()
- func (m *TxMessage) Reset()
- func (m *TxMessage) Size() (n int)
- func (m *TxMessage) String() string
- func (m *TxMessage) Unmarshal(dAtA []byte) error
- func (m *TxMessage) XXX_DiscardUnknown()
- func (m *TxMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TxMessage) XXX_Merge(src proto.Message)
- func (m *TxMessage) XXX_Size() int
- func (m *TxMessage) XXX_Unmarshal(b []byte) error
- type TxMsgSubProcessor
- type TxPoolActor
- type TxPoolMessage
- func (*TxPoolMessage) Descriptor() ([]byte, []int)
- func (m *TxPoolMessage) GetData() []byte
- func (m *TxPoolMessage) GetFromDomain() []byte
- func (m *TxPoolMessage) GetFromNode() []byte
- func (m *TxPoolMessage) GetMsgType() TxPoolMessage_TxPoolMessageType
- func (m *TxPoolMessage) Marshal() (dAtA []byte, err error)
- func (m *TxPoolMessage) MarshalTo(dAtA []byte) (int, error)
- func (m *TxPoolMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*TxPoolMessage) ProtoMessage()
- func (m *TxPoolMessage) Reset()
- func (m *TxPoolMessage) Size() (n int)
- func (m *TxPoolMessage) String() string
- func (m *TxPoolMessage) Unmarshal(dAtA []byte) error
- func (m *TxPoolMessage) XXX_DiscardUnknown()
- func (m *TxPoolMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TxPoolMessage) XXX_Merge(src proto.Message)
- func (m *TxPoolMessage) XXX_Size() int
- func (m *TxPoolMessage) XXX_Unmarshal(b []byte) error
- type TxPoolMessage_TxPoolMessageType
- type TxRepublishPolicy
Constants ¶
View Source
const ( MetaData_TxPool_Tx = "MD_TP_Tx" MetaData_TxPool_Config = "MD_TP_Config" )
View Source
const ( ChanAddTxsSize = 1024 * 1024 ChanBlockAddedSize = 64 ChanDelTxsStorage = 20 * 1024 ChanSaveTxsStorage = 20 * 1024 TxCacheSize = 1024 * 1024 AccountNonceCacheSize = 40 * 1024 MaxUint64 = 1<<64 - 1 )
Variables ¶
View Source
var ( ErrInvalidLengthMessageTxpool = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowMessageTxpool = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupMessageTxpool = fmt.Errorf("proto: unexpected end of group") )
View Source
var ( ExpiredTxsInterval = 2000 * time.Millisecond RepublishTxInterval = 1000 * time.Millisecond RepublishTxLimit = 50 ObsID string ErrAlreadyKnown = errors.New("transaction is already know") ErrTxNotExist = errors.New("transaction not found") ErrAddrNotExist = errors.New("address not found") ErrNoTxAdded = errors.New("no transactions add to txPool") ErrNonceNotMin = errors.New("nonce is not min when remove tx") ErrTxIDDiff = errors.New("TxID is different for the same nonce ") ErrTxIsPackaged = errors.New("transaction is packaged can't be replaced") ErrTxIsNil = errors.New("transaction is nil") ErrUnRooted = errors.New("UnRooted new chain") ErrTxStoragePath = errors.New("error tx storage path") ErrTxPoolFull = errors.New("tx pool is full") )
View Source
var TxPoolMessage_TxPoolMessageType_name = map[int32]string{
0: "Unknown",
1: "Tx",
}
View Source
var TxPoolMessage_TxPoolMessageType_value = map[string]int32{
"Unknown": 0,
"Tx": 1,
}
Functions ¶
func NewTransactionPool ¶
func NewTransactionPool(exeDomainID string, nodeID string, ctx context.Context, conf *tpconfig.TransactionPoolConfig, level tplogcmm.LogLevel, log tplog.Logger, codecType codec.CodecType, stateQueryService service.StateQueryService, blockService service.BlockService, network tpnet.Network, ledger ledger.Ledger) txpooli.TransactionPool
func NewTransactionPoolHandler ¶
func NewTransactionPoolHandler(log tplog.Logger, txPool *transactionPool, txMsgSub TxMsgSubProcessor) *transactionPoolHandler
Types ¶
type BlockAddedEvent ¶
type BlockAddedEvent struct{ Block *tpchaintypes.Block }
type BlocksRevertEvent ¶
type BlocksRevertEvent struct {
Blocks []*tpchaintypes.Block
}
type PickTxType ¶
type PickTxType uint32
const ( PickTxPending PickTxType = iota PickTxPriceAndNonce PickTxPriceAndTime )
type TransactionPoolHandler ¶
type TransactionPoolServant ¶
type TransactionPoolServant interface {
CurrentHeight() (uint64, error)
GetNonce(tpcrtypes.Address) (uint64, error)
GetLatestBlock() (*tpchaintypes.Block, error)
GetBlockByHash(hash tpchaintypes.BlockHash) (*tpchaintypes.Block, error)
GetBlockByNumber(blockNum tpchaintypes.BlockNum) (*tpchaintypes.Block, error)
GetLedger() ledger.Ledger
PublishTx(ctx context.Context, marshaler codec.Marshaler, topic string, domainID string, nodeID string, tx *txbasic.Transaction) error
Subscribe(ctx context.Context, topic string, localIgnore bool, validators ...message.PubSubMessageValidator) error
UnSubscribe(topic string) error
CreateTopic(topic string)
// contains filtered or unexported methods
}
type TxExpiredPolicy ¶
type TxExpiredPolicy byte
const ( TxExpiredTime TxExpiredPolicy = iota TxExpiredHeight TxExpiredTimeAndHeight TxExpiredTimeOrHeight )
type TxMessage ¶
type TxMessage struct {
Data []byte `protobuf:"bytes,1,opt,name=Data,proto3" json:"data"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*TxMessage) Descriptor ¶
func (*TxMessage) MarshalToSizedBuffer ¶
func (*TxMessage) ProtoMessage ¶
func (*TxMessage) ProtoMessage()
func (*TxMessage) XXX_DiscardUnknown ¶
func (m *TxMessage) XXX_DiscardUnknown()
func (*TxMessage) XXX_Marshal ¶
func (*TxMessage) XXX_Unmarshal ¶
type TxMsgSubProcessor ¶
type TxMsgSubProcessor interface {
Validate(ctx context.Context, isLocal bool, data []byte) message.ValidationResult
Process(ctx context.Context, subMsgTxMessage *TxMessage) error
}
func NewTxMsgSubProcessor ¶
func NewTxMsgSubProcessor(exeDomainID string, nodeID string, log tplog.Logger, txPool *transactionPool) TxMsgSubProcessor
type TxPoolActor ¶
type TxPoolActor struct {
// contains filtered or unexported fields
}
func (*TxPoolActor) Receive ¶
func (ta *TxPoolActor) Receive(context actor.Context)
type TxPoolMessage ¶
type TxPoolMessage struct {
MsgType TxPoolMessage_TxPoolMessageType `protobuf:"varint,1,opt,name=MsgType,proto3,enum=proto.TxPoolMessage_TxPoolMessageType" json:"msgType"`
FromDomain []byte `protobuf:"bytes,2,opt,name=FromDomain,proto3" json:"fromDomain"`
FromNode []byte `protobuf:"bytes,3,opt,name=FromNode,proto3" json:"fromNode"`
Data []byte `protobuf:"bytes,4,opt,name=Data,proto3" json:"data"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*TxPoolMessage) Descriptor ¶
func (*TxPoolMessage) Descriptor() ([]byte, []int)
func (*TxPoolMessage) GetData ¶
func (m *TxPoolMessage) GetData() []byte
func (*TxPoolMessage) GetFromDomain ¶
func (m *TxPoolMessage) GetFromDomain() []byte
func (*TxPoolMessage) GetFromNode ¶
func (m *TxPoolMessage) GetFromNode() []byte
func (*TxPoolMessage) GetMsgType ¶
func (m *TxPoolMessage) GetMsgType() TxPoolMessage_TxPoolMessageType
func (*TxPoolMessage) Marshal ¶
func (m *TxPoolMessage) Marshal() (dAtA []byte, err error)
func (*TxPoolMessage) MarshalToSizedBuffer ¶
func (m *TxPoolMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*TxPoolMessage) ProtoMessage ¶
func (*TxPoolMessage) ProtoMessage()
func (*TxPoolMessage) Reset ¶
func (m *TxPoolMessage) Reset()
func (*TxPoolMessage) Size ¶
func (m *TxPoolMessage) Size() (n int)
func (*TxPoolMessage) String ¶
func (m *TxPoolMessage) String() string
func (*TxPoolMessage) Unmarshal ¶
func (m *TxPoolMessage) Unmarshal(dAtA []byte) error
func (*TxPoolMessage) XXX_DiscardUnknown ¶
func (m *TxPoolMessage) XXX_DiscardUnknown()
func (*TxPoolMessage) XXX_Marshal ¶
func (m *TxPoolMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*TxPoolMessage) XXX_Merge ¶
func (m *TxPoolMessage) XXX_Merge(src proto.Message)
func (*TxPoolMessage) XXX_Size ¶
func (m *TxPoolMessage) XXX_Size() int
func (*TxPoolMessage) XXX_Unmarshal ¶
func (m *TxPoolMessage) XXX_Unmarshal(b []byte) error
type TxPoolMessage_TxPoolMessageType ¶
type TxPoolMessage_TxPoolMessageType int32
const ( TxPoolMessage_Unknown TxPoolMessage_TxPoolMessageType = 0 TxPoolMessage_Tx TxPoolMessage_TxPoolMessageType = 1 )
func (TxPoolMessage_TxPoolMessageType) EnumDescriptor ¶
func (TxPoolMessage_TxPoolMessageType) EnumDescriptor() ([]byte, []int)
func (TxPoolMessage_TxPoolMessageType) String ¶
func (x TxPoolMessage_TxPoolMessageType) String() string
type TxRepublishPolicy ¶
type TxRepublishPolicy byte
const ( TxRepublishTime TxRepublishPolicy = iota TxRepublishHeight TxRepublishTimeAndHeight TxRepublishTimeOrHeight )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.