mov

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: AGPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Core added in v1.1.0

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

Core represent the core logic of the match module, which include generate match transactions before packing the block, verify the match transaction in block is correct, and update the order table according to the transaction.

func NewCore added in v1.1.0

func NewCore(dbBackend, dbDir string, startBlockHeight uint64) *Core

NewCore return a instance of Core by path of mov db

func NewCoreWithDB added in v1.1.0

func NewCoreWithDB(store *database.LevelDBMovStore, startBlockHeight uint64) *Core

NewCoreWithDB return a instance of Core by movStore

func (*Core) ApplyBlock added in v1.1.0

func (m *Core) ApplyBlock(block *types.Block) error

ApplyBlock parse pending order and cancel from the the transactions of block and add pending order to the dex db, remove cancel order from dex db.

func (*Core) BeforeProposalBlock added in v1.1.0

func (m *Core) BeforeProposalBlock(txs []*types.Tx, blockHeight uint64, gasLeft int64, isTimeout func() bool) ([]*types.Tx, error)

BeforeProposalBlock return all transactions than can be matched, and the number of transactions cannot exceed the given capacity.

func (*Core) ChainStatus added in v1.1.0

func (m *Core) ChainStatus() (uint64, *bc.Hash, error)

ChainStatus return the current block height and block hash in dex core

func (*Core) DetachBlock added in v1.1.0

func (m *Core) DetachBlock(block *types.Block) error

DetachBlock parse pending order and cancel from the the transactions of block and add cancel order to the dex db, remove pending order from dex db.

func (*Core) InitChainStatus added in v1.1.1

func (m *Core) InitChainStatus(startHash *bc.Hash) error

InitChainStatus used to init the start block height and start block hash to store

func (*Core) IsDust added in v1.1.0

func (m *Core) IsDust(tx *types.Tx) bool

IsDust block the transaction that are not generated by the match engine

func (*Core) Name added in v1.1.0

func (m *Core) Name() string

Name return the name of current module

func (*Core) StartHeight added in v1.1.0

func (m *Core) StartHeight() uint64

StartHeight return the start block height of current module

func (*Core) ValidateBlock added in v1.1.0

func (m *Core) ValidateBlock(block *types.Block, verifyResults []*bc.TxVerifyResult) error

ValidateBlock no need to verify the block header, because the first module has been verified. just need to verify the transactions in the block.

func (*Core) ValidateTx added in v1.1.0

func (m *Core) ValidateTx(tx *types.Tx, verifyResult *bc.TxVerifyResult, blockHeight uint64) error

ValidateTx validate one transaction.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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