blkmanage

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LogManBlk    = "区块生成验证引擎"
	CommonBlk    = "common"
	BroadcastBlk = "broadcast"
)

Functions

This section is empty.

Types

type BlKSupport

type BlKSupport interface {
	BlockChain() *core.BlockChain
	TxPool() *core.TxPoolManager
	SignHelper() *signhelper.SignHelper
	EventMux() *event.TypeMux
	ReElection() *reelection.ReElection
}

type ChainReader

type ChainReader interface {
	// Config retrieves the blockchain's chain configuration.
	Config() *params.ChainConfig

	// CurrentHeader retrieves the current header from the local chain.
	CurrentHeader() *types.Header

	// GetHeader retrieves a block header from the database by hash and number.
	GetHeader(hash common.Hash, number uint64) *types.Header

	// GetHeaderByNumber retrieves a block header from the database by number.
	GetHeaderByNumber(number uint64) *types.Header

	// GetHeaderByHash retrieves a block header from the database by its hash.
	GetHeaderByHash(hash common.Hash) *types.Header

	// GetBlock retrieves a block from the database by hash and number.
	GetBlock(hash common.Hash, number uint64) *types.Block

	Genesis() *types.Block

	GetBlockByHash(hash common.Hash) *types.Block

	GetCurrentHash() common.Hash
	GetGraphByHash(hash common.Hash) (*mc.TopologyGraph, *mc.ElectGraph, error)
	GetVersionSuperAccounts(blockHash common.Hash) ([]common.Address, error)
	GetBlockSuperAccounts(blockHash common.Hash) ([]common.Address, error)
	GetBroadcastInterval() (*mc.BCIntervalInfo, error)

	ProcessUpTime(state *state.StateDBManage, header *types.Header) (map[common.Address]uint64, error)
	StateAt(root []common.CoinRoot) (*state.StateDBManage, error)
	Engine(version []byte) consensus.Engine
	DPOSEngine(version []byte) consensus.DPOSEngine
	Processor(version []byte) core.Processor
	VerifyHeader(header *types.Header) error
}

type MANBLK

type MANBLK interface {
	// Prepare initializes the consensus fields of a block header according to the
	// rules of a particular engine. The changes are executed inline.
	Prepare(types string, version string, num uint64, interval *mc.BCIntervalInfo, args ...interface{}) (*types.Header, interface{}, error)
	ProcessState(types string, version string, header *types.Header, args ...interface{}) ([]*common.RetCallTxN, *state.StateDB, []*types.Receipt, []types.SelfTransaction, []types.SelfTransaction, interface{}, error)
	Finalize(types string, version string, header *types.Header, state *state.StateDB, txs []types.SelfTransaction, uncles []*types.Header, receipts []*types.Receipt, args interface{}) (*types.Block, interface{}, error)
	VerifyHeader(types string, version string, header *types.Header, args ...interface{}) (interface{}, error)
	VerifyTxsAndState(types string, version string, header *types.Header, Txs types.SelfTransactions, args ...interface{}) (*state.StateDB, types.SelfTransactions, []*types.Receipt, interface{}, error)
}

type MANBLKPlUGS

type MANBLKPlUGS interface {
	// Prepare initializes the consensus fields of a block header according to the
	// rules of a particular engine. The changes are executed inline.
	Prepare(version string, support BlKSupport, interval *mc.BCIntervalInfo, num uint64, args interface{}) (*types.Header, interface{}, error)
	ProcessState(support BlKSupport, header *types.Header, args interface{}) ([]*common.RetCallTxN, *state.StateDBManage, []types.CoinReceipts, []types.CoinSelfTransaction, []types.CoinSelfTransaction, interface{}, error)
	Finalize(support BlKSupport, header *types.Header, state *state.StateDBManage, txs []types.CoinSelfTransaction, uncles []*types.Header, receipts []types.CoinReceipts, args interface{}) (*types.Block, interface{}, error)
	VerifyHeader(version string, support BlKSupport, header *types.Header, args interface{}) (interface{}, error)
	VerifyTxsAndState(support BlKSupport, header *types.Header, Txs []types.CoinSelfTransaction, args interface{}) (*state.StateDBManage, []types.CoinSelfTransaction, []types.CoinReceipts, interface{}, error)
}

type ManBCBlkPlug

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

func NewBCBlkPlug

func NewBCBlkPlug() (*ManBCBlkPlug, error)

func (*ManBCBlkPlug) Finalize

func (bd *ManBCBlkPlug) Finalize(support BlKSupport, header *types.Header, state *state.StateDBManage, txs []types.CoinSelfTransaction, uncles []*types.Header, receipts []types.CoinReceipts, args interface{}) (*types.Block, interface{}, error)

func (*ManBCBlkPlug) Prepare

func (bd *ManBCBlkPlug) Prepare(version string, support BlKSupport, interval *mc.BCIntervalInfo, num uint64, args interface{}) (*types.Header, interface{}, error)

func (*ManBCBlkPlug) ProcessState

func (bd *ManBCBlkPlug) ProcessState(support BlKSupport, header *types.Header, args interface{}) ([]*common.RetCallTxN, *state.StateDBManage, []types.CoinReceipts, []types.CoinSelfTransaction, []types.CoinSelfTransaction, interface{}, error)

func (*ManBCBlkPlug) VerifyHeader

func (bd *ManBCBlkPlug) VerifyHeader(version string, support BlKSupport, header *types.Header, args interface{}) (interface{}, error)

func (*ManBCBlkPlug) VerifyTxsAndState

func (bd *ManBCBlkPlug) VerifyTxsAndState(support BlKSupport, verifyHeader *types.Header, verifyTxs []types.CoinSelfTransaction, args interface{}) (*state.StateDBManage, []types.CoinSelfTransaction,
	[]types.CoinReceipts, interface{}, error)

type ManBlkBasePlug

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

func NewBlkBasePlug

func NewBlkBasePlug() (*ManBlkBasePlug, error)

func (*ManBlkBasePlug) Finalize

func (bd *ManBlkBasePlug) Finalize(support BlKSupport, header *types.Header, state *state.StateDBManage, txs []types.CoinSelfTransaction, uncles []*types.Header, receipts []types.CoinReceipts, args interface{}) (*types.Block, interface{}, error)

func (*ManBlkBasePlug) Prepare

func (bd *ManBlkBasePlug) Prepare(version string, support BlKSupport, interval *mc.BCIntervalInfo, num uint64, args interface{}) (*types.Header, interface{}, error)

func (*ManBlkBasePlug) ProcessState

func (bd *ManBlkBasePlug) ProcessState(support BlKSupport, header *types.Header, args interface{}) ([]*common.RetCallTxN, *state.StateDBManage, []types.CoinReceipts, []types.CoinSelfTransaction, []types.CoinSelfTransaction, interface{}, error)

func (*ManBlkBasePlug) VerifyHeader

func (bd *ManBlkBasePlug) VerifyHeader(version string, support BlKSupport, header *types.Header, args interface{}) (interface{}, error)

func (*ManBlkBasePlug) VerifyTxsAndState

func (bd *ManBlkBasePlug) VerifyTxsAndState(support BlKSupport, verifyHeader *types.Header, verifyTxs []types.CoinSelfTransaction, args interface{}) (*state.StateDBManage, []types.CoinSelfTransaction,
	[]types.CoinReceipts, interface{}, error)

type ManBlkManage

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

func New

func New(support BlKSupport) (*ManBlkManage, error)

func (*ManBlkManage) Finalize

func (bd *ManBlkManage) Finalize(types string, version string, header *types.Header, state *state.StateDBManage, txs []types.CoinSelfTransaction, uncles []*types.Header, receipts []types.CoinReceipts, args ...interface{}) (*types.Block, interface{}, error)

func (*ManBlkManage) Prepare

func (bd *ManBlkManage) Prepare(types string, version string, num uint64, interval *mc.BCIntervalInfo, args ...interface{}) (*types.Header, interface{}, error)

func (*ManBlkManage) ProcessState

func (bd *ManBlkManage) ProcessState(types string, version string, header *types.Header, args ...interface{}) ([]*common.RetCallTxN, *state.StateDBManage, []types.CoinReceipts, []types.CoinSelfTransaction, []types.CoinSelfTransaction, interface{}, error)

func (*ManBlkManage) ProduceBlockVersion

func (bd *ManBlkManage) ProduceBlockVersion(num uint64, preVersion string) string

func (*ManBlkManage) RegisterManBLkPlugs

func (bd *ManBlkManage) RegisterManBLkPlugs(types string, version string, plug MANBLKPlUGS)

func (*ManBlkManage) VerifyBlockVersion

func (bd *ManBlkManage) VerifyBlockVersion(num uint64, curVersion string, preVersion string) error

func (*ManBlkManage) VerifyHeader

func (bd *ManBlkManage) VerifyHeader(types string, version string, header *types.Header, args ...interface{}) (interface{}, error)

func (*ManBlkManage) VerifyTxsAndState

func (bd *ManBlkManage) VerifyTxsAndState(types string, version string, header *types.Header, Txs []types.CoinSelfTransaction, args ...interface{}) (*state.StateDBManage, []types.CoinSelfTransaction, []types.CoinReceipts, interface{}, error)

type Mux

type Mux interface {
	// Pending should return pending transactions.
	// The slice should be modifiable by the caller.
	EventMux() *event.TypeMux
}

type Reelection

type Reelection interface {
	VerifyNetTopology(header *types.Header, onlineConsensusResults []*mc.HD_OnlineConsensusVoteResultMsg) error
	VerifyElection(header *types.Header, state *state.StateDB) error
	GetNetTopology(num uint64, parentHash common.Hash, bcInterval *mc.BCIntervalInfo) (*common.NetTopology, []*mc.HD_OnlineConsensusVoteResultMsg)
	GenElection(state *state.StateDB, preBlockHash common.Hash) []common.Elect
	VerifyVrf(header *types.Header) error
}

type SignHelper

type SignHelper interface {
	SignVrf(msg []byte, blkHash common.Hash) ([]byte, []byte, []byte, error)
}

type TopNodeService

type TopNodeService interface {
	GetConsensusOnlineResults() []*mc.HD_OnlineConsensusVoteResultMsg
}

type VrfMsg

type VrfMsg struct {
	VrfValue []byte
	VrfProof []byte
	Hash     common.Hash
}

Jump to

Keyboard shortcuts

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