Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DISCONNECT means that two branches are not connected DISCONNECT ChainState = 1 // CONNECTED means that two branches are connected CONNECTED = 2 // FORKED means that two branches are connected, but forked FORKED = 3 )
Variables ¶
View Source
var ErrAllIn = errors.New("all in")
View Source
var ErrBlackList = errors.New("block in blacklist")
View Source
var ErrCurrentChainModify = errors.New("current chain modify")
View Source
var ErrEmptyMain = errors.New("empty chainpool")
View Source
var ErrMax = errors.New("arrived to max")
View Source
var ErrQuotaNotEnough = errors.New("block quota not enough")
Functions ¶
This section is empty.
Types ¶
type BCPool ¶
type BCPool struct { ID string // contains filtered or unexported fields }
BCPool is the basis for account pool and snapshot pool
func (*BCPool) CurrentChain ¶
CurrentChain returns the main branch
func (*BCPool) CurrentModifyToChain ¶
CurrentModifyToChain switch target branch to main branch
func (*BCPool) CurrentModifyToEmpty ¶
CurrentModifyToEmpty switch empty branch to main branch
type Blacklist ¶
type Blacklist interface { Add(key types.Hash) AddAddTimeout(key types.Hash, duration time.Duration) Exists(key types.Hash) bool Remove(key types.Hash) }
Blacklist define a data set interface with a timeout
type BlockPool ¶
type BlockPool interface { Writer Reader SnapshotProducerWriter Debug Start() Stop() Init(s syncer, wt *wallet.Manager, snapshotV *verifier.SnapshotVerifier, accountV verifier.Verifier, cs consensus.Consensus) }
BlockPool is responsible for organizing blocks and inserting it into the chain
type ByTailHeight ¶
type ByTailHeight []*snippetChain
ByTailHeight sorts snippetChain by tail height
func (ByTailHeight) Len ¶
func (a ByTailHeight) Len() int
func (ByTailHeight) Less ¶
func (a ByTailHeight) Less(i, j int) bool
func (ByTailHeight) Swap ¶
func (a ByTailHeight) Swap(i, j int)
type ChainState ¶
type ChainState uint8
ChainState represents the relationship between the two branches
type Debug ¶
type Debug interface { Info() map[string]interface{} AccountBlockInfo(addr types.Address, hash types.Hash) interface{} SnapshotBlockInfo(hash types.Hash) interface{} Snapshot() map[string]interface{} SnapshotPendingNum() uint64 AccountPendingNum() *big.Int Account(addr types.Address) map[string]interface{} SnapshotChainDetail(chainID string, height uint64) map[string]interface{} AccountChainDetail(addr types.Address, chainID string, height uint64) map[string]interface{} }
Debug provide more detail info for BlockPool
type Reader ¶
type Reader interface {
GetIrreversibleBlock() *ledger.SnapshotBlock
}
Reader is a reader of BlockPool
type SnapshotProducerWriter ¶
type SnapshotProducerWriter interface { lock.ChainInsert lock.ChainRollback AddDirectSnapshotBlock(block *ledger.SnapshotBlock) error }
SnapshotProducerWriter is a writer for snapshot producer
Source Files ¶
Click to show internal directories.
Click to hide internal directories.