onroad_pool

package
v2.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// OnRoadPool
	ErrOnRoadPoolNotAvailable         = errors.New("target gid's onRoadPool is not available")
	ErrCheckIsCallerFrontOnRoadFailed = errors.New("onRoadPool check the Caller's front onroad hash failed")

	//panic
	ErrLoadCallerCacheFailed = errors.New("load callerCache failed")
	ErrFindCompleteBlock     = errors.New("failed to find complete block by hash")
)

Functions

func NewCallerCache

func NewCallerCache(address types.Address, storage *onroadStorage) *callerCache

Types

type OnRoadBlock

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

func LedgerBlockToOnRoad

func LedgerBlockToOnRoad(chain chainReader, block *ledger.AccountBlock) (*OnRoadBlock, error)

type OnRoadDB added in v2.11.3

type OnRoadDB interface {
	InsertOnroad(tx OnroadTx) error
	DeleteOnroad(tx OnroadTx) error
}

type OnRoadPool

type OnRoadPool interface {
	InsertAccountBlocks(orAddr types.Address, blocks []*ledger.AccountBlock) error
	DeleteAccountBlocks(orAddr types.Address, blocks []*ledger.AccountBlock) error

	GetOnRoadTotalNumByAddr(addr types.Address) (uint64, error)
	GetFrontOnRoadBlocksByAddr(addr types.Address) ([]*ledger.AccountBlock, error)

	IsFrontOnRoadOfCaller(orAddr, caller types.Address, hash types.Hash) (bool, error)
	Info() map[string]interface{}
}

func NewContractOnRoadPool

func NewContractOnRoadPool(gid types.Gid, chain chainReader, db *leveldb.DB) OnRoadPool

type OnroadTx added in v2.11.3

type OnroadTx struct {
	FromAddr types.Address
	ToAddr   types.Address

	FromHeight uint64 // if the block is r-s block, the height means receive block height.
	FromHash   types.Hash
	FromIndex  *uint32
}

func (OnroadTx) String added in v2.11.3

func (tx OnroadTx) String() string

type PendingOnRoadList

type PendingOnRoadList []*OnRoadBlock

func (PendingOnRoadList) Len

func (pList PendingOnRoadList) Len() int

func (PendingOnRoadList) Less

func (pList PendingOnRoadList) Less(i, j int) bool

func (PendingOnRoadList) Swap

func (pList PendingOnRoadList) Swap(i, j int)

Jump to

Keyboard shortcuts

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