actpool

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: Apache-2.0 Imports: 13 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActPool

type ActPool interface {
	// Reset resets actpool state
	Reset()
	// PickActs returns all currently accepted actions in actpool
	PickActs() []action.Action
	// Add adds an action into the pool after passing validation
	Add(act action.Action) 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) []action.Action
	// GetActionByHash returns the pending action in pool given action's hash
	GetActionByHash(hash hash.Hash32B) (action.Action, error)
	// GetSize returns the act pool size
	GetSize() uint64
	// GetCapacity returns the act pool capacity
	GetCapacity() uint64
	// AddActionValidators add validators
	AddActionValidators(...ActionValidator)
}

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(action.Action) bool
	Put(action.Action) error
	FilterNonce(uint64) []action.Action
	SetStartNonce(uint64)
	StartNonce() uint64
	UpdateQueue(uint64) []action.Action
	SetPendingNonce(uint64)
	PendingNonce() uint64
	SetPendingBalance(*big.Int)
	PendingBalance() *big.Int
	Len() int
	Empty() bool
	PendingActs() []action.Action
	AllActs() []action.Action
}

ActQueue is the interface of actQueue

func NewActQueue

func NewActQueue() ActQueue

NewActQueue create a new action queue

type ActionValidator added in v0.4.0

type ActionValidator interface {
	Validate(context.Context, action.Action) error
}

ActionValidator is the interface of validating an action

type GenericValidator added in v0.4.0

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

GenericValidator is the validator for generic action verification

func NewGenericValidator added in v0.4.0

func NewGenericValidator(bc blockchain.Blockchain) *GenericValidator

NewGenericValidator constructs a new genericValidator

func (*GenericValidator) Validate added in v0.4.0

func (v *GenericValidator) Validate(_ context.Context, act action.Action) error

Validate validates an generic action

Jump to

Keyboard shortcuts

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