common

package
v0.0.0-...-c8e9c26 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2018 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_CAPACITY    = 100140                           // The tx pool's capacity that holds the verified txs
	MAX_PENDING_TXN = 4096 * 10                        // The max length of pending txs
	MAX_WORKER_NUM  = 2                                // The max concurrent workers
	MAX_RCV_TXN_LEN = MAX_WORKER_NUM * MAX_PENDING_TXN // The max length of the queue that server can hold
	MAX_RETRIES     = 0                                // The retry times to verify tx
	EXPIRE_INTERVAL = 9                                // The timeout that verify tx
	STATELESS_MASK  = 0x1                              // The mask of stateless validator
	STATEFUL_MASK   = 0x2                              // The mask of stateful validator
	VERIFY_MASK     = STATELESS_MASK | STATEFUL_MASK   // The mask that indicates tx valid
	MAX_LIMITATION  = 10000                            // The length of pending tx from net and http
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActorType

type ActorType uint8
const (
	TxActor        ActorType // Actor that handles new transaction
	TxPoolActor              // Actor that handles consensus msg
	VerifyRspActor           // Actor that handles the response from valdiators
	NetActor                 // Actor to send msg to the net actor
	MaxActor
)

type CheckTxnReq

type CheckTxnReq struct {
	Hash common.Uint256
}

type CheckTxnRsp

type CheckTxnRsp struct {
	Ok bool
}

type GetPendingTxnReq

type GetPendingTxnReq struct {
	ByCount bool
}

type GetPendingTxnRsp

type GetPendingTxnRsp struct {
	Txs []*types.Transaction
}

type GetTxnPoolReq

type GetTxnPoolReq struct {
	ByCount bool
	Height  uint32
}

consensus messages

type GetTxnPoolRsp

type GetTxnPoolRsp struct {
	TxnPool []*TXEntry
}

type GetTxnReq

type GetTxnReq struct {
	Hash common.Uint256
}

restful api

type GetTxnRsp

type GetTxnRsp struct {
	Txn *types.Transaction
}

type GetTxnStats

type GetTxnStats struct {
}

type GetTxnStatsRsp

type GetTxnStatsRsp struct {
	Count []uint64
}

type GetTxnStatusReq

type GetTxnStatusReq struct {
	Hash common.Uint256
}

type GetTxnStatusRsp

type GetTxnStatusRsp struct {
	Hash     common.Uint256
	TxStatus []*TXAttr
}

type LB

type LB struct {
	Size     int
	WorkerID uint8
}

* Implement sort.Interface

type LBSlice

type LBSlice []LB

func (LBSlice) Len

func (this LBSlice) Len() int

func (LBSlice) Less

func (this LBSlice) Less(i, j int) bool

func (LBSlice) Swap

func (this LBSlice) Swap(i, j int)

type SenderType

type SenderType uint8
const (
	NilSender  SenderType = iota
	NetSender             // Net sends tx req
	HttpSender            // Http sends tx req
)

func (SenderType) Sender

func (sender SenderType) Sender() string

type TXAttr

type TXAttr struct {
	Height  uint32         // The height in which tx was verified
	Type    vt.VerifyType  // The validator flag: stateless/stateful
	ErrCode errors.ErrCode // Verified result
}

type TXEntry

type TXEntry struct {
	Tx    *types.Transaction // transaction which has been verified
	Fee   common.Fixed64     // Total fee per transaction
	Attrs []*TXAttr          // the result from each validator
}

type TXPool

type TXPool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*TXPool) AddTxList

func (tp *TXPool) AddTxList(txEntry *TXEntry) bool

func (*TXPool) CleanTransactionList

func (tp *TXPool) CleanTransactionList(txs []*types.Transaction) error

clean the trasaction Pool with committed transactions.

func (*TXPool) DelTxList

func (tp *TXPool) DelTxList(tx *types.Transaction) bool

func (*TXPool) GetTransaction

func (tp *TXPool) GetTransaction(hash common.Uint256) *types.Transaction

func (*TXPool) GetTransactionCount

func (tp *TXPool) GetTransactionCount() int

func (*TXPool) GetTxPool

func (tp *TXPool) GetTxPool(byCount bool) []*TXEntry

func (*TXPool) GetTxStatus

func (tp *TXPool) GetTxStatus(hash common.Uint256) *TxStatus

func (*TXPool) Init

func (tp *TXPool) Init()

type TxReq

type TxReq struct {
	Tx     *types.Transaction
	Sender SenderType
}

type TxRsp

type TxRsp struct {
	Hash    common.Uint256
	ErrCode errors.ErrCode
}

type TxStatus

type TxStatus struct {
	Hash  common.Uint256 // transaction hash
	Attrs []*TXAttr      // transaction's status
}

type TxnStatsType

type TxnStatsType uint8
const (
	RcvStats       TxnStatsType // The count that the tx pool receive from the actor bus
	SuccessStats                // The count that the transactions are verified successfully
	FailureStats                // The count that the transactions are invalid
	DuplicateStats              // The count that the transactions are duplicated input
	SigErrStats                 // The count that the transactions' signature error
	StateErrStats               // The count that the transactions are invalid in database

	MaxStats
)

type VerifyBlockReq

type VerifyBlockReq struct {
	Height uint32
	Txs    []*types.Transaction
}

type VerifyBlockRsp

type VerifyBlockRsp struct {
	TxnPool []*VerifyTxResult
}

type VerifyTxResult

type VerifyTxResult struct {
	Height  uint32
	Tx      *types.Transaction
	ErrCode errors.ErrCode
}

Jump to

Keyboard shortcuts

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