Documentation
¶
Index ¶
Constants ¶
View Source
const ( // TransferSizeLimit is the maximum size of transfer allowed TransferSizeLimit = 32 * 1024 // VoteSizeLimit is the maximum size of vote allowed VoteSizeLimit = 262 )
Variables ¶
View Source
var ( // ErrActPool indicates the error of actpool ErrActPool = errors.New("invalid actpool") // ErrGasHigherThanLimit indicates the error of gas value ErrGasHigherThanLimit = errors.New("invalid gas for execution") // ErrInsufficientGas indicates the error of insufficient gas value for data storage ErrInsufficientGas = errors.New("insufficient intrinsic gas value") // ErrTransfer indicates the error of transfer ErrTransfer = errors.New("invalid transfer") // ErrNonce indicates the error of nonce ErrNonce = errors.New("invalid nonce") // ErrBalance indicates the error of balance ErrBalance = errors.New("invalid balance") // ErrVotee indicates the error of votee ErrVotee = errors.New("votee is not a candidate") // ErrHash indicates the error of action's hash ErrHash = errors.New("invalid hash") )
Functions ¶
This section is empty.
Types ¶
type ActPool ¶
type ActPool interface {
// Reset resets actpool state
Reset()
// PickActs returns all currently accepted transfers and votes in actpool
PickActs() ([]*action.Transfer, []*action.Vote, []*action.Execution)
// AddTsf adds an transfer into the pool after passing validation
AddTsf(tsf *action.Transfer) error
// AddVote adds a vote into the pool after passing validation
AddVote(vote *action.Vote) error
// AddExecution adds an execution into the pool after passing validation
AddExecution(execution *action.Execution) error
// GetPendingNonce returns pending nonce in pool given an account address
GetPendingNonce(addr string) (uint64, error)
// GetUnconfirmedActs returns unconfirmed actions in pool given an account address
GetUnconfirmedActs(addr string) []*iproto.ActionPb
// GetActionByHash returns the pending action in pool given action's hash
GetActionByHash(hash hash.Hash32B) (*iproto.ActionPb, error)
}
ActPool is the interface of actpool
func NewActPool ¶
func NewActPool(bc blockchain.Blockchain, cfg config.ActPool) (ActPool, error)
NewActPool constructs a new actpool
type ActQueue ¶
type ActQueue interface {
Overlaps(*iproto.ActionPb) bool
Put(*iproto.ActionPb) error
FilterNonce(uint64) []*iproto.ActionPb
SetStartNonce(uint64)
StartNonce() uint64
UpdateQueue(uint64) []*iproto.ActionPb
SetPendingNonce(uint64)
PendingNonce() uint64
SetPendingBalance(*big.Int)
PendingBalance() *big.Int
Len() int
Empty() bool
PendingActs() []*iproto.ActionPb
AllActs() []*iproto.ActionPb
}
ActQueue is the interface of actQueue
Click to show internal directories.
Click to hide internal directories.