chain

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxAnchors = 32
	//MaxAnchors = 1000000
	Skip = 16
)
View Source
const (

	// ReorgStat is a constant representing a stat about reorganization.
	ReorgStat statIndex = iota
	// MaxStat is a constant representing a value less than which all the
	// constants corresponding chain stats must be.
	MaxStat
)
View Source
const (
	DEBUG_CHAIN_STOP_INF = DEBUG_RAFT_SNAP_FREQ
)
View Source
const MaxEventSize = 4 * 1024 * 1024

Variables

View Source
var (
	ErrorBlockVerifySign           = errors.New("Block verify failed")
	ErrorBlockVerifyTxRoot         = errors.New("Block verify failed, because Tx root hash is invaild")
	ErrorBlockVerifyExistStateRoot = errors.New("Block verify failed, because state root hash is already exist")
	ErrorBlockVerifyStateRoot      = errors.New("Block verify failed, because state root hash is not equal")
	ErrorBlockVerifyReceiptRoot    = errors.New("Block verify failed, because receipt root hash is not equal")
)
View Source
var (
	// ErrNoChainDB reports chaindb is not prepared.
	ErrNoChainDB           = fmt.Errorf("chaindb not prepared")
	ErrorLoadBestBlock     = errors.New("failed to load latest block from DB")
	ErrCantDropGenesis     = errors.New("can't drop genesis block")
	ErrTooBigResetHeight   = errors.New("reset height is too big")
	ErrWalNoHardState      = errors.New("not exist hard state")
	ErrInvalidHardState    = errors.New("invalid hard state")
	ErrInvalidRaftSnapshot = errors.New("invalid raft snapshot")
	ErrInvalidCCProgress   = errors.New("invalid conf change progress")
)
View Source
var (
	ErrMismatchedEntry    = errors.New("mismatched entry")
	ErrNoWalEntry         = errors.New("no entry")
	ErrEncodeRaftIdentity = errors.New("failed encoding of raft identity")
	ErrDecodeRaftIdentity = errors.New("failed decoding of raft identity")
	ErrNoWalEntryForBlock = errors.New("no raft entry for block")
	ErrNilHardState       = errors.New("hardstateinfo must not be nil")
)
View Source
var (
	ErrWalNotEqualIdentityName   = errors.New("name of identity is not equal")
	ErrWalNotEqualIdentityPeerID = errors.New("peerid of identity is not equal")
)
View Source
var (
	ErrorNoAncestor      = errors.New("not found ancestor")
	ErrBlockOrphan       = errors.New("block is ohphan, so not connected in chain")
	ErrBlockCachedErrLRU = errors.New("block is in errored blocks cache")
	ErrStateNoMarker     = errors.New("statedb marker of block is not exists")

	InAddBlock      = make(chan struct{}, 1)
	SendBlockReward = sendRewardCoinbase
)
View Source
var (
	ErrNotSupportedConsensus = errors.New("not supported by this consensus")
	ErrRecoNoBestStateRoot   = errors.New("state root of best block is not exist")
	ErrRecoInvalidSdbRoot    = errors.New("state root of sdb is invalid")

	TestDebugger *Debugger
)
View Source
var (
	CoinbaseAccount []byte
	MaxAnchorCount  int
	VerifierCount   int

	Genesis *types.Genesis
)
View Source
var (
	// ErrInvalidCoinbaseAccount is returned by Init when the coinbase account
	// address is invalid.
	ErrInvalidCoinbaseAccount = errors.New("invalid coinbase account in config")
	ErrInvalidConsensus       = errors.New("invalid consensus name from genesis")
)
View Source
var (
	EnvNameStaticCrash     = "DEBUG_CHAIN_CRASH"       // 1 ~ 4
	EnvNameRandomCrashTime = "DEBUG_RANDOM_CRASH_TIME" // 1 ~ 600000(=10min) ms
	EnvNameChainBPSleep    = "DEBUG_CHAIN_BP_SLEEP"    // bp node sleeps before connecting block for each block (ms). used
	EnvNameChainOtherSleep = "DEBUG_CHAIN_OTHER_SLEEP" // non bp node sleeps before connecting block for each block (ms).
	EnvNameSyncCrash       = "DEBUG_SYNCER_CRASH"      // case 1
	EnvNameRaftSnapFreq    = "DEBUG_RAFT_SNAP_FREQ"    // case 1
)
View Source
var (
	DfltOrphanPoolSize = 100

	ErrRemoveOldestOrphan = errors.New("failed to remove oldest orphan block")
	ErrNotExistOrphanLRU  = errors.New("given orphan doesn't exist in lru")
)
View Source
var (
	ErrInvalidPrevHash = errors.New("no of previous hash block is invalid")
	ErrRecoInvalidBest = errors.New("best block is not equal to old chain")
)
View Source
var (
	ErrInvalidReorgMarker = errors.New("reorg marker is invalid")
	ErrMarkerNil          = errors.New("reorg marker is nil")
)
View Source
var (
	ErrInvalidBranchRoot  = errors.New("best block can't be branch root block")
	ErrGatherChain        = errors.New("new/old blocks must exist")
	ErrNotExistBranchRoot = errors.New("branch root block doesn't exist")
	ErrInvalidSwapChain   = errors.New("New chain is not longer than old chain")
	ErrInvalidBlockHeader = errors.New("invalid block header")
)
View Source
var (
	ErrNotExistHash  = errors.New("not exist hash")
	ErrNotExistBlock = errors.New("not exist block of the hash")
)
View Source
var (
	ErrTxFormatInvalid = errors.New("tx invalid format")
)

Functions

func ConsensusName added in v1.0.0

func ConsensusName() string

func DecorateBlockRewardFn added in v1.3.3

func DecorateBlockRewardFn(fn BlockRewardFn)

func Init

func Init(maxBlkBodySize uint32, coinbaseAccountStr string, isBp bool, maxAnchorCount int, verifierCount int) error

Init initializes the blockchain-related parameters.

func InitGenesisBPs

func InitGenesisBPs(states *state.StateDB, genesis *types.Genesis) error

InitGenesisBPs opens system contract and put initial voting result it also set *State in Genesis to use statedb

func IsPublic added in v0.9.4

func IsPublic() bool

IsPublic reports whether the block chain is public or not.

func MaxBlockBodySize added in v1.0.0

func MaxBlockBodySize() uint32

MaxBlockBodySize returns the max block body size.

func MaxBlockSize

func MaxBlockSize() uint32

MaxBlockSize returns the max block size.

func RecoverExit added in v1.3.3

func RecoverExit()

Types

type BlockReader added in v1.3.3

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

type BlockRewardFn added in v1.3.3

type BlockRewardFn = func(*state.BlockState, []byte) error

type BlockValidator

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

func (*BlockValidator) Stop

func (bv *BlockValidator) Stop()

func (*BlockValidator) ValidateBlock

func (bv *BlockValidator) ValidateBlock(block *types.Block) error

func (*BlockValidator) ValidateBody

func (bv *BlockValidator) ValidateBody(block *types.Block) error

func (*BlockValidator) ValidateHeader

func (bv *BlockValidator) ValidateHeader(header *types.BlockHeader) error

func (*BlockValidator) ValidatePost

func (bv *BlockValidator) ValidatePost(sdbRoot []byte, receipts *types.Receipts, block *types.Block) error

func (*BlockValidator) WaitVerifyDone added in v0.8.3

func (bv *BlockValidator) WaitVerifyDone() error

type ChainAnchor

type ChainAnchor []([]byte)

type ChainDB

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

func NewChainDB

func NewChainDB() *ChainDB

func (*ChainDB) ClearWAL added in v1.3.3

func (cdb *ChainDB) ClearWAL()

ClearWal() removes all data used by raft

func (*ChainDB) Close

func (cdb *ChainDB) Close()

func (*ChainDB) Get

func (cdb *ChainDB) Get(key []byte) []byte

Get returns the value corresponding to key from the chain DB.

func (*ChainDB) GetBestBlock

func (cdb *ChainDB) GetBestBlock() (*types.Block, error)

func (*ChainDB) GetBlock added in v1.3.3

func (cdb *ChainDB) GetBlock(blockHash []byte) (*types.Block, error)

func (*ChainDB) GetBlockByNo

func (cdb *ChainDB) GetBlockByNo(blockNo types.BlockNo) (*types.Block, error)

GetBlockByNo returns the block with its block number as blockNo.

func (*ChainDB) GetChainTree

func (cdb *ChainDB) GetChainTree() ([]byte, error)

func (*ChainDB) GetConfChangeProgress added in v1.3.3

func (cdb *ChainDB) GetConfChangeProgress(id uint64) (*types.ConfChangeProgress, error)

func (*ChainDB) GetGenesisInfo added in v0.8.2

func (cdb *ChainDB) GetGenesisInfo() *types.Genesis

GetGenesisInfo returns Genesis info, which is read from cdb.

func (*ChainDB) GetHardState added in v1.3.3

func (cdb *ChainDB) GetHardState() (*raftpb.HardState, error)

func (*ChainDB) GetHashByNo added in v1.3.3

func (cdb *ChainDB) GetHashByNo(blockNo types.BlockNo) ([]byte, error)

func (*ChainDB) GetIdentity added in v1.3.3

func (cdb *ChainDB) GetIdentity() (*consensus.RaftIdentity, error)

func (*ChainDB) GetRaftEntry added in v1.3.3

func (cdb *ChainDB) GetRaftEntry(idx uint64) (*consensus.WalEntry, error)

func (*ChainDB) GetRaftEntryIndexOfBlock added in v1.3.3

func (cdb *ChainDB) GetRaftEntryIndexOfBlock(hash []byte) (uint64, error)

func (*ChainDB) GetRaftEntryLastIdx added in v1.3.3

func (cdb *ChainDB) GetRaftEntryLastIdx() (uint64, error)

func (*ChainDB) GetRaftEntryOfBlock added in v1.3.3

func (cdb *ChainDB) GetRaftEntryOfBlock(hash []byte) (*consensus.WalEntry, error)

func (*ChainDB) GetSnapshot added in v1.3.3

func (cdb *ChainDB) GetSnapshot() (*raftpb.Snapshot, error)
func (cdb *ChainDB) WriteSnapshotDone() error {
	data, err := encodeBool(true)
	if err != nil {
		return err
	}

	dbTx := cdb.store.NewTx()
	dbTx.Set(raftSnapStatusKey, data)
	dbTx.Commit()

	return nil
}
func (cdb *ChainDB) GetSnapshotDone() (bool, error) {
	data := cdb.store.Get(raftSnapStatusKey)
	if len(data) == 0 {
		return false, nil
	}

	val, err := decodeBool(data)
	if err != nil {
		return false, err
	}

	return val, nil
}

func (*ChainDB) Hardfork added in v1.3.3

func (cdb *ChainDB) Hardfork() config.HardforkDbConfig

func (*ChainDB) HasWal added in v1.3.3

func (cdb *ChainDB) HasWal(identity consensus.RaftIdentity) (bool, error)

HasWal checks chaindb has valid status of Raft WAL. 1. compare identity with config 2. check if hardstate exists 3. check if last raft entiry index exists last entry index can be 0 if first sync has failed

func (*ChainDB) Init

func (cdb *ChainDB) Init(dbType string, dataDir string) error

func (*ChainDB) IsNew added in v1.3.3

func (cdb *ChainDB) IsNew() bool

implement ChainWAL interface

func (*ChainDB) NewTx added in v0.9.4

func (cdb *ChainDB) NewTx() db.Transaction

NewTx returns a new chain DB Transaction.

func (*ChainDB) ResetBest added in v0.11.0

func (cdb *ChainDB) ResetBest(resetNo types.BlockNo) error

ResetBest reset best block of chain db manually remove blocks from original best to resetNo.

*Caution*: This API is dangerous. It must be used for test blockchain only.

func (*ChainDB) ResetWAL added in v1.3.3

func (cdb *ChainDB) ResetWAL(hardStateInfo *types.HardStateInfo) error

func (*ChainDB) WriteConfChangeProgress added in v1.3.3

func (cdb *ChainDB) WriteConfChangeProgress(id uint64, progress *types.ConfChangeProgress) error

func (*ChainDB) WriteHardState added in v1.3.3

func (cdb *ChainDB) WriteHardState(hardstate *raftpb.HardState) error

func (*ChainDB) WriteHardfork added in v1.3.3

func (cdb *ChainDB) WriteHardfork(c *config.HardforkConfig) error

func (*ChainDB) WriteIdentity added in v1.3.3

func (cdb *ChainDB) WriteIdentity(identity *consensus.RaftIdentity) error

func (*ChainDB) WriteRaftEntry added in v1.3.3

func (cdb *ChainDB) WriteRaftEntry(ents []*consensus.WalEntry, blocks []*types.Block, ccProposes []*raftpb.ConfChange) error

func (*ChainDB) WriteSnapshot added in v1.3.3

func (cdb *ChainDB) WriteSnapshot(snap *raftpb.Snapshot) error

type ChainInfo

type ChainInfo struct {
	Height types.BlockNo
	Hash   string
}

type ChainManager added in v0.8.2

type ChainManager struct {
	*SubComponent
	IChainHandler //to use chain APIs
	*Core         // TODO remove after moving GetQuery to ChainWorker
}

func (*ChainManager) Receive added in v0.8.2

func (cm *ChainManager) Receive(context actor.Context)

type ChainService

type ChainService struct {
	*component.BaseComponent
	consensus.ChainConsensus
	*Core
	// contains filtered or unexported fields
}

ChainService manage connectivity of blocks

func NewChainService

func NewChainService(cfg *cfg.Config) *ChainService

NewChainService creates an instance of ChainService.

func (*ChainService) AfterStart

func (cs *ChainService) AfterStart()

AfterStart ... do nothing

func (*ChainService) BeforeStart

func (cs *ChainService) BeforeStart()

BeforeStart initialize chain database and generate empty genesis block if necessary

func (*ChainService) BeforeStop

func (cs *ChainService) BeforeStop()

BeforeStop close chain database and stop BlockValidator

func (*ChainService) CDB added in v0.9.4

func (cs *ChainService) CDB() consensus.ChainDB

CDB returns cs.sdb as a consensus.ChainDbReader.

func (*ChainService) ChainID added in v1.3.3

func (cs *ChainService) ChainID(bno types.BlockNo) *types.ChainID

func (*ChainService) ConsensusType added in v1.3.3

func (cs *ChainService) ConsensusType() string

func (*ChainService) CountTxsInChain

func (cs *ChainService) CountTxsInChain() int

func (*ChainService) GetBestBlock

func (cs *ChainService) GetBestBlock() (*types.Block, error)

func (*ChainService) GetBlock

func (cs *ChainService) GetBlock(blockHash []byte) (*types.Block, error)

func (*ChainService) GetChainStats added in v1.3.3

func (cs *ChainService) GetChainStats() string

func (*ChainService) GetChainTree

func (cs *ChainService) GetChainTree() ([]byte, error)

func (*ChainService) GetConsensusInfo added in v1.0.0

func (cs *ChainService) GetConsensusInfo() string

GetConsensusInfo returns consensus-related information, which is different from consensus to consensus.

func (*ChainService) GetEnterpriseConfig added in v1.3.3

func (cs *ChainService) GetEnterpriseConfig(key string) (*types.EnterpriseConfig, error)

GetEnterpriseConfig return EnterpiseConfig. if the given key does not exist, fill EnterpriseConfig with only the key and return

func (*ChainService) GetGenesisInfo added in v0.11.0

func (cs *ChainService) GetGenesisInfo() *types.Genesis

GetGenesisInfo returns the information on the genesis block.

func (*ChainService) GetHashByNo added in v0.8.1

func (cs *ChainService) GetHashByNo(blockNo types.BlockNo) ([]byte, error)

func (*ChainService) GetSystemValue added in v1.3.3

func (cs *ChainService) GetSystemValue(key types.SystemValue) (*big.Int, error)

func (*ChainService) IsPublic added in v1.3.3

func (cs *ChainService) IsPublic() bool

func (*ChainService) Receive

func (cs *ChainService) Receive(context actor.Context)

Receive actor message

func (*ChainService) Recover added in v1.3.3

func (cs *ChainService) Recover() error

Recover has 2 situation

  1. normal recovery normal recovery recovers error that has occures while adding single block
  2. reorg recovery reorg recovery recovers error that has occures while executing reorg

func (*ChainService) SDB added in v0.8.2

func (cs *ChainService) SDB() *state.ChainStateDB

SDB returns cs.sdb.

func (*ChainService) SetChainConsensus added in v0.8.2

func (cs *ChainService) SetChainConsensus(cc consensus.ChainConsensus)

SetChainConsensus sets cs.cc to cc.

func (*ChainService) Statistics

func (cs *ChainService) Statistics() *map[string]interface{}

func (*ChainService) WalDB added in v1.3.3

func (cs *ChainService) WalDB() consensus.ChainWAL

WalDB returns cs.sdb as a consensus.ChainDbReader.

type ChainTree

type ChainTree struct {
	Tree []ChainInfo
}

type ChainVerifier added in v1.3.3

type ChainVerifier struct {
	*SubComponent

	IChainHandler //to use chain APIs
	*Core
	// contains filtered or unexported fields
}

func (*ChainVerifier) IsRunning added in v1.3.3

func (cv *ChainVerifier) IsRunning() bool

func (*ChainVerifier) Receive added in v1.3.3

func (cv *ChainVerifier) Receive(context actor.Context)

func (*ChainVerifier) Statistics added in v1.3.3

func (cv *ChainVerifier) Statistics() *map[string]interface{}

func (*ChainVerifier) VerifyChain added in v1.3.3

func (cv *ChainVerifier) VerifyChain() error

type ChainWorker added in v0.8.2

type ChainWorker struct {
	*SubComponent
	IChainHandler //to use chain APIs
	*Core
}

func (*ChainWorker) Receive added in v0.8.2

func (cw *ChainWorker) Receive(context actor.Context)

type Core added in v0.8.2

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

Core represents a storage layer of a blockchain (chain & state DB).

func NewCore added in v0.8.2

func NewCore(dbType string, dataDir string, testModeOn bool, forceResetHeight types.BlockNo) (*Core, error)

NewCore returns an instance of Core.

func (*Core) Close added in v0.8.2

func (core *Core) Close()

Close closes chain & state DB.

func (*Core) GetGenesisInfo added in v0.12.0

func (core *Core) GetGenesisInfo() *types.Genesis

func (*Core) InitGenesisBlock added in v0.8.2

func (core *Core) InitGenesisBlock(gb *types.Genesis, useTestnet bool) error

InitGenesisBlock initialize chain database and generate specified genesis block if necessary

type DebugHandler added in v1.3.3

type DebugHandler func(value int) error

type Debugger added in v1.3.3

type Debugger struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Debugger) Check added in v1.3.3

func (debug *Debugger) Check(cond StopCond, value int, handler DebugHandler) error

func (*Debugger) Set added in v1.3.3

func (debug *Debugger) Set(cond StopCond, value int, env bool)

func (*Debugger) Unset added in v1.3.3

func (debug *Debugger) Unset(cond StopCond)

type ErrBlock added in v0.8.1

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

func (*ErrBlock) Error added in v0.8.1

func (ec *ErrBlock) Error() string

type ErrDebug added in v1.3.3

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

func (*ErrDebug) Error added in v1.3.3

func (ec *ErrDebug) Error() string

type ErrDropBlock added in v0.11.0

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

func (*ErrDropBlock) Error added in v0.11.0

func (err *ErrDropBlock) Error() string

type ErrNoBlock

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

ErrNoBlock reports there is no such a block with id (hash or block number).

func (ErrNoBlock) Error

func (e ErrNoBlock) Error() string

type ErrReorg added in v0.9.4

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

func (*ErrReorg) Error added in v0.9.4

func (ec *ErrReorg) Error() string

type ErrReorgBlock

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

func (*ErrReorgBlock) Error

func (ec *ErrReorgBlock) Error() string

type ErrTx

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

func (*ErrTx) Error

func (ec *ErrTx) Error() string

type IChainHandler added in v0.8.2

type IChainHandler interface {
	// contains filtered or unexported methods
}

type OrphanBlock

type OrphanBlock struct {
	*types.Block
}

type OrphanPool

type OrphanPool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewOrphanPool

func NewOrphanPool(size int) *OrphanPool

type ReorgMarker added in v1.3.3

type ReorgMarker struct {
	BrStartHash []byte
	BrStartNo   types.BlockNo
	BrBestHash  []byte
	BrBestNo    types.BlockNo
	BrTopHash   []byte
	BrTopNo     types.BlockNo
	// contains filtered or unexported fields
}

func NewReorgMarker added in v1.3.3

func NewReorgMarker(reorg *reorganizer) *ReorgMarker

func (*ReorgMarker) RecoverChainMapping added in v1.3.3

func (rm *ReorgMarker) RecoverChainMapping(cdb *ChainDB) error

RecoverChainMapping rollback chain (no/hash) mapping to old chain of reorg. it is required for LIB loading

type SignVerifier

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

func NewSignVerifier

func NewSignVerifier(comm component.IComponentRequester, sdb *state.ChainStateDB, workerCnt int, useMempool bool) *SignVerifier

func (*SignVerifier) RequestVerifyTxs added in v0.8.3

func (sv *SignVerifier) RequestVerifyTxs(txlist *types.TxList)

func (*SignVerifier) SetSkipMempool added in v0.10.0

func (sv *SignVerifier) SetSkipMempool(val bool)

func (*SignVerifier) Stop

func (sv *SignVerifier) Stop()

func (*SignVerifier) WaitDone added in v0.8.3

func (sv *SignVerifier) WaitDone() (bool, []error)

type StopCond added in v1.3.3

type StopCond int
const (
	DEBUG_CHAIN_STOP StopCond = 0 + iota
	DEBUG_CHAIN_RANDOM_STOP
	DEBUG_CHAIN_BP_SLEEP
	DEBUG_CHAIN_OTHER_SLEEP
	DEBUG_SYNCER_CRASH
	DEBUG_RAFT_SNAP_FREQ // change snap frequency after first snapshot
)

stop before swap chain

func (StopCond) String added in v1.3.3

func (c StopCond) String() string

type StubBlockChain added in v0.9.4

type StubBlockChain struct {
	Best   int
	Hashes []([]byte)
	Blocks []*types.Block

	BestBlock *types.Block
}

StubSyncer receive Syncer, P2P, Chain Service actor message

func InitStubBlockChain added in v0.9.4

func InitStubBlockChain(prefixChain []*types.Block, genCount int) *StubBlockChain

func NewStubBlockChain added in v0.9.4

func NewStubBlockChain(size int) *StubBlockChain

func (*StubBlockChain) AddBlock added in v0.9.4

func (tchain *StubBlockChain) AddBlock(newBlock *types.Block) error

func (*StubBlockChain) ChainID added in v1.3.3

func (tchain *StubBlockChain) ChainID(bno types.BlockNo) *types.ChainID

func (*StubBlockChain) GenAddBlock added in v0.9.4

func (tchain *StubBlockChain) GenAddBlock()

func (*StubBlockChain) GetAncestorWithHashes added in v0.9.4

func (tchain *StubBlockChain) GetAncestorWithHashes(hashes [][]byte) *types.BlockInfo

func (*StubBlockChain) GetAnchors added in v0.9.4

func (tchain *StubBlockChain) GetAnchors() (ChainAnchor, types.BlockNo, error)

TODO refactoring with getAnchorsNew()

func (*StubBlockChain) GetBestBlock added in v0.9.4

func (tchain *StubBlockChain) GetBestBlock() (*types.Block, error)

func (*StubBlockChain) GetBlock added in v0.9.4

func (tchain *StubBlockChain) GetBlock(blockHash []byte) (*types.Block, error)

func (*StubBlockChain) GetBlockByNo added in v0.9.4

func (tchain *StubBlockChain) GetBlockByNo(no uint64) *types.Block

func (*StubBlockChain) GetBlockInfo added in v0.9.4

func (tchain *StubBlockChain) GetBlockInfo(no uint64) *types.BlockInfo

func (*StubBlockChain) GetBlocks added in v0.9.4

func (tchain *StubBlockChain) GetBlocks(hashes []message.BlockHash) ([]*types.Block, error)

func (*StubBlockChain) GetChainStats added in v1.3.3

func (tchain *StubBlockChain) GetChainStats() string

func (*StubBlockChain) GetConsensusInfo added in v1.0.0

func (tchain *StubBlockChain) GetConsensusInfo() string

func (*StubBlockChain) GetEnterpriseConfig added in v1.3.3

func (tchain *StubBlockChain) GetEnterpriseConfig(key string) (*types.EnterpriseConfig, error)

func (*StubBlockChain) GetGenesisInfo added in v0.11.0

func (tchain *StubBlockChain) GetGenesisInfo() *types.Genesis

func (*StubBlockChain) GetHashByNo added in v0.9.4

func (tchain *StubBlockChain) GetHashByNo(blockNo types.BlockNo) ([]byte, error)

func (*StubBlockChain) GetHashes added in v0.9.4

func (tchain *StubBlockChain) GetHashes(prevInfo *types.BlockInfo, count uint64) ([]message.BlockHash, error)

func (*StubBlockChain) GetSystemValue added in v1.3.3

func (tchain *StubBlockChain) GetSystemValue(key types.SystemValue) (*big.Int, error)

func (*StubBlockChain) Rollback added in v0.9.4

func (tchain *StubBlockChain) Rollback(ancestor *types.BlockInfo)

type SubComponent added in v0.8.2

type SubComponent struct {
	actor.Actor
	component.IComponentRequester // use basecomponent to request to other actors
	// contains filtered or unexported fields
}

SubComponent handles message with Receive(), and requests to other actor services with IComponentRequester To use SubComponent, only need to implement Actor interface

func NewSubComponent added in v0.8.2

func NewSubComponent(subactor actor.Actor, requester *component.BaseComponent, name string, cntWorker int) *SubComponent

func (*SubComponent) Request added in v0.8.2

func (sub *SubComponent) Request(message interface{}, respondTo *actor.PID)

send message to this subcomponent and reply to actor with pid respondTo

func (*SubComponent) Start added in v0.8.2

func (sub *SubComponent) Start()

spawn new subactor

func (*SubComponent) Stop added in v0.8.2

func (sub *SubComponent) Stop()

stop subactor

type TxExecFn

type TxExecFn func(bState *state.BlockState, tx types.Transaction) error

func NewTxExecutor

func NewTxExecutor(ccc consensus.ChainConsensusCluster, cdb contract.ChainAccessor, bi *types.BlockHeaderInfo, preLoadService int) TxExecFn

NewTxExecutor returns a new TxExecFn.

type ValidatePostFn

type ValidatePostFn func() error

type ValidateSignWaitFn added in v0.8.3

type ValidateSignWaitFn func() error

type VerifyResult

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

Jump to

Keyboard shortcuts

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