Documentation ¶
Overview ¶
Package dbnamespace contains constants that define the database namespaces for the purpose of the blockdag, so that external callers may easily access this data.
Index ¶
- Constants
- Variables
- func DBDelBlockIdByHash(dbTx database.Tx, h *hash.Hash) error
- func DBDelDAGBlock(dbTx database.Tx, id uint) error
- func DBDelDAGTip(dbTx database.Tx, id uint) error
- func DBDelDiffAnticone(dbTx database.Tx, id uint) error
- func DBGetBlockIdByHash(dbTx database.Tx, h *hash.Hash) (uint32, error)
- func DBGetBlockIdByOrder(dbTx database.Tx, order uint) (uint32, error)
- func DBGetDAGBlock(dbTx database.Tx, block IBlock) error
- func DBGetDAGTips(dbTx database.Tx) ([]uint, error)
- func DBGetDiffAnticone(dbTx database.Tx) ([]uint, error)
- func DBHasMainChainBlock(dbTx database.Tx, id uint) bool
- func DBPutBlockIdByOrder(dbTx database.Tx, order uint, id uint) error
- func DBPutDAGBlock(dbTx database.Tx, block IBlock) error
- func DBPutDAGBlockIdByHash(dbTx database.Tx, block IBlock) error
- func DBPutDAGInfo(dbTx database.Tx, bd *MeerDAG) error
- func DBPutDAGTip(dbTx database.Tx, id uint, isMain bool) error
- func DBPutDiffAnticone(dbTx database.Tx, id uint) error
- func DBPutMainChainBlock(dbTx database.Tx, id uint) error
- func DBRemoveMainChainBlock(dbTx database.Tx, id uint) error
- func GetDAGTypeByIndex(dagType byte) string
- func GetDAGTypeIndex(dagType string) byte
- func GetMaxLenHashSet(bsm map[hash.Hash]*HashSet) *hash.Hash
- func GetOrderLogStr(order uint) string
- func GetRisk(N int, alpha float64, lambda float64, delay float64, waitingTime uint, ...) float64
- func NewDAGError(e error) error
- func UseLogger(logger l.Logger)
- type Block
- func (b *Block) AddChild(child IBlock)
- func (b *Block) AddParent(parent IBlock)
- func (b *Block) AttachChild(ib IBlock)
- func (b *Block) AttachParent(ib IBlock)
- func (b *Block) Decode(r io.Reader) error
- func (b *Block) DetachChild(ib IBlock)
- func (b *Block) DetachParent(ib IBlock)
- func (b *Block) Encode(w io.Writer) error
- func (b *Block) GetChildren() *IdSet
- func (b *Block) GetData() IBlockData
- func (b *Block) GetHash() *hash.Hash
- func (b *Block) GetHeight() uint
- func (b *Block) GetID() uint
- func (b *Block) GetLayer() uint
- func (b *Block) GetMainParent() uint
- func (b *Block) GetOrder() uint
- func (b *Block) GetParents() *IdSet
- func (b *Block) GetStatus() BlockStatus
- func (b *Block) GetWeight() uint64
- func (b *Block) HasChildren() bool
- func (b *Block) HasParents() bool
- func (b *Block) Invalid()
- func (b *Block) IsLoaded() bool
- func (b *Block) IsOrdered() bool
- func (b *Block) RemoveChild(child uint)
- func (b *Block) RemoveParent(id uint)
- func (b *Block) SetData(data IBlockData)
- func (b *Block) SetHeight(h uint)
- func (b *Block) SetID(id uint)
- func (b *Block) SetLayer(layer uint)
- func (b *Block) SetOrder(o uint)
- func (b *Block) SetStatus(status BlockStatus)
- func (b *Block) SetStatusFlags(flags BlockStatus)
- func (b *Block) SetWeight(weight uint64)
- func (b *Block) UnsetStatusFlags(flags BlockStatus)
- func (b *Block) Valid()
- type BlockHashSlice
- type BlockHeightSlice
- type BlockOrderHelp
- type BlockOrderSlice
- type BlockPrioritySlice
- type BlockSlice
- type BlockStatus
- type BlueInfo
- type CalcWeight
- type Conflux
- func (con *Conflux) AddBlock(b IBlock) (*list.List, *list.List)
- func (con *Conflux) CreateBlock(b *Block) IBlock
- func (con *Conflux) Decode(r io.Reader) error
- func (con *Conflux) Encode(w io.Writer) error
- func (con *Conflux) GetBlues(parents *IdSet) uint
- func (con *Conflux) GetMainChain() []uint
- func (con *Conflux) GetMainChainTip() IBlock
- func (con *Conflux) GetMainChainTipId() uint
- func (con *Conflux) GetMainParent(parents *IdSet) IBlock
- func (con *Conflux) GetMainParentConcurrency(b IBlock) int
- func (con *Conflux) GetName() string
- func (con *Conflux) GetTipsList() []IBlock
- func (con *Conflux) Init(bd *MeerDAG) bool
- func (con *Conflux) IsBlue(id uint) bool
- func (con *Conflux) IsDAG(parents []IBlock) bool
- func (con *Conflux) Load() error
- type ConsensusAlgorithm
- type DAGError
- type DAGSnapshot
- type DAGSync
- type Empty
- type Epoch
- type GetBlockData
- type GhostDAG
- func (gd *GhostDAG) AddBlock(ib IBlock) (*list.List, *list.List)
- func (gd *GhostDAG) BlockHeader(dbContext model.DBReader, stagingArea *model.StagingArea, blockHash *hash.Hash) (model.BlockHeader, error)
- func (gd *GhostDAG) BlockHeaders(dbContext model.DBReader, stagingArea *model.StagingArea, ...) ([]model.BlockHeader, error)
- func (gd *GhostDAG) ChildInSelectedParentChainOf(stagingArea *model.StagingArea, lowHash, highHash *hash.Hash) (*hash.Hash, error)
- func (gd *GhostDAG) Children(stagingArea *model.StagingArea, blockHash *hash.Hash) ([]*hash.Hash, error)
- func (gd *GhostDAG) Count(stagingArea *model.StagingArea) uint64
- func (gd *GhostDAG) CreateBlock(b *Block) IBlock
- func (gd *GhostDAG) Decode(r io.Reader) error
- func (gd *GhostDAG) Delete(stagingArea *model.StagingArea, blockHash *hash.Hash)
- func (gd *GhostDAG) Encode(w io.Writer) error
- func (gd *GhostDAG) Get(dbContext model.DBReader, stagingArea *model.StagingArea, blockHash *hash.Hash, ...) (*model.BlockGHOSTDAGData, error)
- func (gd *GhostDAG) GetBlueSet() *IdSet
- func (gd *GhostDAG) GetBlues(parents *IdSet) uint
- func (gd *GhostDAG) GetMainChainTip() IBlock
- func (gd *GhostDAG) GetMainChainTipId() uint
- func (gd *GhostDAG) GetMainParent(parents *IdSet) IBlock
- func (gd *GhostDAG) GetMainParentConcurrency(b IBlock) int
- func (gd *GhostDAG) GetName() string
- func (gd *GhostDAG) GetTipsList() []IBlock
- func (gd *GhostDAG) HasBlockHeader(dbContext model.DBReader, stagingArea *model.StagingArea, blockHash *hash.Hash) (bool, error)
- func (gd *GhostDAG) Init(bd *MeerDAG) bool
- func (gd *GhostDAG) IsAncestorOf(stagingArea *model.StagingArea, blockHashA *hash.Hash, blockHashB *hash.Hash) (bool, error)
- func (gd *GhostDAG) IsAncestorOfAny(stagingArea *model.StagingArea, blockHash *hash.Hash, ...) (bool, error)
- func (gd *GhostDAG) IsAnyAncestorOf(stagingArea *model.StagingArea, potentialAncestors []*hash.Hash, ...) (bool, error)
- func (gd *GhostDAG) IsBlue(id uint) bool
- func (gd *GhostDAG) IsChildOf(stagingArea *model.StagingArea, blockHashA *hash.Hash, blockHashB *hash.Hash) (bool, error)
- func (gd *GhostDAG) IsDAG(parents []IBlock) bool
- func (gd *GhostDAG) IsInSelectedParentChainOf(stagingArea *model.StagingArea, blockHashA *hash.Hash, blockHashB *hash.Hash) (bool, error)
- func (gd *GhostDAG) IsParentOf(stagingArea *model.StagingArea, blockHashA *hash.Hash, blockHashB *hash.Hash) (bool, error)
- func (gd *GhostDAG) IsStaged(stagingArea *model.StagingArea) bool
- func (gd *GhostDAG) Load() error
- func (gd *GhostDAG) Parents(stagingArea *model.StagingArea, blockHash *hash.Hash) ([]*hash.Hash, error)
- func (gd *GhostDAG) SetParents(stagingArea *model.StagingArea, blockHash *hash.Hash, ...) error
- func (gd *GhostDAG) Stage(stagingArea *model.StagingArea, blockHash *hash.Hash, ...)
- func (gd *GhostDAG) UnstageAll(stagingArea *model.StagingArea)
- func (gd *GhostDAG) UpdateOrders() error
- type GraphState
- func (gs *GraphState) Clone() *GraphState
- func (gs *GraphState) Decode(r io.Reader, pver uint32) error
- func (gs *GraphState) Encode(w io.Writer, pver uint32) error
- func (gs *GraphState) Equal(other *GraphState)
- func (gs *GraphState) GetLayer() uint
- func (gs *GraphState) GetMainChainTip() *hash.Hash
- func (gs *GraphState) GetMainHeight() uint
- func (gs *GraphState) GetMainOrder() uint
- func (gs *GraphState) GetTips() *HashSet
- func (gs *GraphState) GetTipsList() []*hash.Hash
- func (gs *GraphState) GetTotal() uint
- func (gs *GraphState) IsEqual(other *GraphState) bool
- func (gs *GraphState) IsExcellent(other *GraphState) bool
- func (gs *GraphState) IsGenesis() bool
- func (gs *GraphState) MaxPayloadLength() uint32
- func (gs *GraphState) SetLayer(layer uint)
- func (gs *GraphState) SetMainHeight(mainHeight uint)
- func (gs *GraphState) SetMainOrder(order uint)
- func (gs *GraphState) SetTips(tips []*hash.Hash)
- func (gs *GraphState) SetTotal(total uint)
- func (gs *GraphState) String() string
- type HashSet
- func (s *HashSet) Add(elem *hash.Hash)
- func (s *HashSet) AddList(list []*hash.Hash)
- func (s *HashSet) AddPair(elem *hash.Hash, data interface{})
- func (s *HashSet) AddSet(other *HashSet)
- func (s *HashSet) Clean()
- func (s *HashSet) Clone() *HashSet
- func (s *HashSet) Contain(other *HashSet) bool
- func (s *HashSet) Exclude(other *HashSet)
- func (s *HashSet) Get(elem *hash.Hash) interface{}
- func (s *HashSet) GetMap() map[hash.Hash]interface{}
- func (s *HashSet) Has(elem *hash.Hash) bool
- func (s *HashSet) HasOnly(elem *hash.Hash) bool
- func (s *HashSet) Intersection(other *HashSet) *HashSet
- func (s *HashSet) IsEmpty() bool
- func (s *HashSet) IsEqual(other *HashSet) bool
- func (s *HashSet) List() []*hash.Hash
- func (s *HashSet) Remove(elem *hash.Hash)
- func (s *HashSet) RemoveSet(other *HashSet)
- func (s *HashSet) Size() int
- func (s *HashSet) SortList(reverse bool) []*hash.Hash
- func (s *HashSet) Union(other *HashSet) *HashSet
- type HashSlice
- type IBlock
- type IBlockData
- type ISpectre
- type IdSet
- func (s *IdSet) Add(elem uint)
- func (s *IdSet) AddList(list []uint)
- func (s *IdSet) AddPair(elem uint, data interface{})
- func (s *IdSet) AddSet(other *IdSet)
- func (s *IdSet) Clean()
- func (s *IdSet) Clone() *IdSet
- func (s *IdSet) Contain(other *IdSet) bool
- func (s *IdSet) Exclude(other *IdSet)
- func (s *IdSet) Get(elem uint) interface{}
- func (s *IdSet) GetMap() map[uint]interface{}
- func (s *IdSet) Has(elem uint) bool
- func (s *IdSet) HasOnly(elem uint) bool
- func (s *IdSet) Intersection(other *IdSet) *IdSet
- func (s *IdSet) IsDataEmpty(elem uint) bool
- func (s *IdSet) IsEmpty() bool
- func (s *IdSet) IsEqual(other *IdSet) bool
- func (s *IdSet) List() []uint
- func (s *IdSet) Remove(elem uint)
- func (s *IdSet) RemoveSet(other *IdSet)
- func (s *IdSet) Size() int
- func (s *IdSet) SortHashList(reverse bool) []uint
- func (s *IdSet) SortHeightList(reverse bool) []uint
- func (s *IdSet) SortList(reverse bool) []uint
- func (s *IdSet) SortPriorityList(reverse bool) []uint
- func (s *IdSet) Union(other *IdSet) *IdSet
- type IdSlice
- type KChain
- type LazySet
- type MainChain
- type MeerDAG
- func (bd *MeerDAG) AddBlock(b IBlockData) (*list.List, *list.List, IBlock, bool)
- func (bd *MeerDAG) BuildMerkleTreeStoreFromTips() []*hash.Hash
- func (bd *MeerDAG) CheckBlueAndMature(targets []uint, views []uint, max uint) error
- func (bd *MeerDAG) CheckBlueAndMatureMT(targets []uint, views []uint, max uint) error
- func (bd *MeerDAG) CheckMainBlueAndMature(target IBlock, targetMainFork IBlock, max uint) (bool, IBlock)
- func (bd *MeerDAG) CheckSubMainChainTip(parents []*hash.Hash) error
- func (bd *MeerDAG) Commit() error
- func (bd *MeerDAG) CreateVirtualBlock(data IBlockData) IBlock
- func (bd *MeerDAG) Decode(r io.Reader) error
- func (bd *MeerDAG) Encode(w io.Writer) error
- func (bd *MeerDAG) GetBlock(h *hash.Hash) IBlock
- func (bd *MeerDAG) GetBlockById(id uint) IBlock
- func (bd *MeerDAG) GetBlockByOrder(order uint) IBlock
- func (bd *MeerDAG) GetBlockCacheSize() uint64
- func (bd *MeerDAG) GetBlockConcurrency(h *hash.Hash) (uint, error)
- func (bd *MeerDAG) GetBlockData(ib IBlock) IBlockData
- func (bd *MeerDAG) GetBlockDataCacheSize() uint64
- func (bd *MeerDAG) GetBlockHash(id uint) *hash.Hash
- func (bd *MeerDAG) GetBlockHashByOrder(order uint) *hash.Hash
- func (bd *MeerDAG) GetBlockId(h *hash.Hash) uint
- func (bd *MeerDAG) GetBlockTotal() uint
- func (bd *MeerDAG) GetBlueInfo(ib IBlock) *BlueInfo
- func (bd *MeerDAG) GetBlueInfoByHash(h *hash.Hash) *BlueInfo
- func (bd *MeerDAG) GetBlues(parents *IdSet) uint
- func (bd *MeerDAG) GetBluesByBlock(ib IBlock) uint
- func (bd *MeerDAG) GetBluesByHash(h *hash.Hash) uint
- func (bd *MeerDAG) GetChildren(ib IBlock) *IdSet
- func (bd *MeerDAG) GetConfirmations(id uint) uint
- func (bd *MeerDAG) GetGenesisHash() *hash.Hash
- func (bd *MeerDAG) GetGraphState() *GraphState
- func (bd *MeerDAG) GetIdSet(hs []*hash.Hash) *IdSet
- func (bd *MeerDAG) GetInstance() ConsensusAlgorithm
- func (bd *MeerDAG) GetLastBlock() IBlock
- func (bd *MeerDAG) GetLastTime() *time.Time
- func (bd *MeerDAG) GetLayer(id uint) uint
- func (bd *MeerDAG) GetMainAncestor(block IBlock, height int64) IBlock
- func (bd *MeerDAG) GetMainChainTip() IBlock
- func (bd *MeerDAG) GetMainParent(parents *IdSet) IBlock
- func (bd *MeerDAG) GetMainParentAndList(parents []*hash.Hash) (IBlock, []*hash.Hash)
- func (bd *MeerDAG) GetMainParentByHashs(parents []*hash.Hash) IBlock
- func (bd *MeerDAG) GetMainParentConcurrency(b IBlock) int
- func (bd *MeerDAG) GetMaturity(target uint, views []uint) uint
- func (bd *MeerDAG) GetMinBlockCacheSize() uint64
- func (bd *MeerDAG) GetMinBlockDataCacheSize() uint64
- func (bd *MeerDAG) GetName() string
- func (bd *MeerDAG) GetParents(ib IBlock) *IdSet
- func (bd *MeerDAG) GetParentsMaxLayer(parents *IdSet) (uint, bool)
- func (bd *MeerDAG) GetPrevious(id uint) (uint, error)
- func (bd *MeerDAG) GetTips() *HashSet
- func (bd *MeerDAG) GetTipsList() []IBlock
- func (bd *MeerDAG) GetValidTips(expectPriority int) []*hash.Hash
- func (bd *MeerDAG) HasBlock(h *hash.Hash) bool
- func (bd *MeerDAG) HasBlockById(id uint) bool
- func (bd *MeerDAG) HasLoadedBlock(id uint) bool
- func (bd *MeerDAG) InvalidBlock(block IBlock)
- func (bd *MeerDAG) IsBlue(id uint) bool
- func (bd *MeerDAG) IsHourglass(id uint) bool
- func (bd *MeerDAG) IsOnMainChain(id uint) bool
- func (bd *MeerDAG) Load(blockTotal uint, genesis *hash.Hash) error
- func (bd *MeerDAG) LoadBlockDataSet(sets *IdSet)
- func (bd *MeerDAG) RelativeMainAncestor(block IBlock, distance int64) IBlock
- func (bd *MeerDAG) SetCacheSize(dag uint64, data uint64)
- func (bd *MeerDAG) SetTipsDisLimit(limit int64)
- func (bd *MeerDAG) SortBlock(src []*hash.Hash) []*hash.Hash
- func (bd *MeerDAG) Start() error
- func (bd *MeerDAG) Stop() error
- func (bd *MeerDAG) UpdateWeight(ib IBlock)
- func (bd *MeerDAG) UpgradeDB(dbTx database.Tx, mainTip *hash.Hash, total uint64, genesis *hash.Hash, ...) error
- func (bd *MeerDAG) ValidBlock(block IBlock)
- type OldBlock
- func (b *OldBlock) AddChild(child IBlock)
- func (b *OldBlock) AddParent(parent IBlock)
- func (b *OldBlock) AttachChild(ib IBlock)
- func (b *OldBlock) AttachParent(ib IBlock)
- func (b *OldBlock) Decode(r io.Reader) error
- func (b *OldBlock) DetachChild(ib IBlock)
- func (b *OldBlock) DetachParent(ib IBlock)
- func (b *OldBlock) Encode(w io.Writer) error
- func (b *OldBlock) GetBackParent() *Block
- func (b *OldBlock) GetChildren() *IdSet
- func (b *OldBlock) GetData() IBlockData
- func (b *OldBlock) GetForwardParent() *Block
- func (b *OldBlock) GetHash() *hash.Hash
- func (b *OldBlock) GetHeight() uint
- func (b *OldBlock) GetID() uint
- func (b *OldBlock) GetLayer() uint
- func (b *OldBlock) GetMainParent() uint
- func (b *OldBlock) GetOrder() uint
- func (b *OldBlock) GetParents() *IdSet
- func (b *OldBlock) GetStatus() BlockStatus
- func (b *OldBlock) GetWeight() uint64
- func (b *OldBlock) HasChildren() bool
- func (b *OldBlock) HasParents() bool
- func (b *OldBlock) Invalid()
- func (b *OldBlock) IsLoaded() bool
- func (b *OldBlock) IsOrdered() bool
- func (b *OldBlock) RemoveChild(child uint)
- func (b *OldBlock) SetData(data IBlockData)
- func (b *OldBlock) SetHeight(h uint)
- func (b *OldBlock) SetID(id uint)
- func (b *OldBlock) SetLayer(layer uint)
- func (b *OldBlock) SetOrder(o uint)
- func (b *OldBlock) SetStatus(status BlockStatus)
- func (b *OldBlock) SetStatusFlags(flags BlockStatus)
- func (b *OldBlock) SetWeight(weight uint64)
- func (b *OldBlock) UnsetStatusFlags(flags BlockStatus)
- func (b *OldBlock) Valid()
- type OldPhantomBlock
- func (pb *OldPhantomBlock) AddPairBlueDiffAnticone(id uint, order uint)
- func (pb *OldPhantomBlock) AddPairRedDiffAnticone(id uint, order uint)
- func (pb *OldPhantomBlock) Decode(r io.Reader) error
- func (pb *OldPhantomBlock) Encode(w io.Writer) error
- func (pb *OldPhantomBlock) GetBlueDiffAnticoneSize() int
- func (pb *OldPhantomBlock) IsBluer(other *OldPhantomBlock) bool
- type Phantom
- func (ph *Phantom) AddBlock(ib IBlock) (*list.List, *list.List)
- func (ph *Phantom) CheckBlockOrderDB(maxDepth uint64) error
- func (ph *Phantom) CheckMainChainDB(maxDepth uint64) error
- func (ph *Phantom) CreateBlock(b *Block) IBlock
- func (ph *Phantom) Decode(r io.Reader) error
- func (ph *Phantom) Encode(w io.Writer) error
- func (ph *Phantom) GetBlues(parents *IdSet) uint
- func (ph *Phantom) GetDiffAnticone() *IdSet
- func (ph *Phantom) GetDiffBlueSet() *IdSet
- func (ph *Phantom) GetMainChainTip() IBlock
- func (ph *Phantom) GetMainChainTipId() uint
- func (ph *Phantom) GetMainParent(parents *IdSet) IBlock
- func (ph *Phantom) GetMainParentConcurrency(b IBlock) int
- func (ph *Phantom) GetName() string
- func (ph *Phantom) GetTipsList() []IBlock
- func (ph *Phantom) Init(bd *MeerDAG) bool
- func (ph *Phantom) IsBlue(id uint) bool
- func (ph *Phantom) IsDAG(parents []IBlock) bool
- func (ph *Phantom) Load() error
- func (ph *Phantom) UpdateVirtualBlockOrder() *PhantomBlock
- func (ph *Phantom) UpdateWeight(ib IBlock)
- type PhantomBlock
- func (pb *PhantomBlock) AddBlueDiffAnticone(id uint)
- func (pb *PhantomBlock) AddPairBlueDiffAnticone(id uint, order uint)
- func (pb *PhantomBlock) AddPairRedDiffAnticone(id uint, order uint)
- func (pb *PhantomBlock) AddRedDiffAnticone(id uint)
- func (pb *PhantomBlock) CleanDiffAnticone()
- func (pb *PhantomBlock) Decode(r io.Reader) error
- func (pb *PhantomBlock) Encode(w io.Writer) error
- func (pb *PhantomBlock) GetBlueDiffAnticone() *IdSet
- func (pb *PhantomBlock) GetBlueDiffAnticoneSize() int
- func (pb *PhantomBlock) GetBlueNum() uint
- func (pb *PhantomBlock) GetDiffAnticoneSize() int
- func (pb *PhantomBlock) GetRedDiffAnticone() *IdSet
- func (pb *PhantomBlock) GetRedDiffAnticoneSize() int
- func (pb *PhantomBlock) HasBlueDiffAnticone(id uint) bool
- func (pb *PhantomBlock) HasRedDiffAnticone(id uint) bool
- func (pb *PhantomBlock) IsBluer(other *PhantomBlock) bool
- type Spectre
- func (sp *Spectre) AddBlock(b IBlock) (*list.List, *list.List)
- func (sp *Spectre) CreateBlock(b *Block) IBlock
- func (sp *Spectre) Decode(r io.Reader) error
- func (sp *Spectre) Encode(w io.Writer) error
- func (sp *Spectre) GetBlues(parents *IdSet) uint
- func (sp *Spectre) GetMainChainTip() IBlock
- func (sp *Spectre) GetMainChainTipId() uint
- func (sp *Spectre) GetMainParent(parents *IdSet) IBlock
- func (sp *Spectre) GetMainParentConcurrency(b IBlock) int
- func (sp *Spectre) GetName() string
- func (sp *Spectre) GetTipsList() []IBlock
- func (sp *Spectre) Init(bd *MeerDAG) bool
- func (sp *Spectre) InitVote(b1 IBlock, b2 IBlock) (bool, error)
- func (sp *Spectre) IsBlue(id uint) bool
- func (sp *Spectre) IsDAG(parents []IBlock) bool
- func (sp *Spectre) IsInPastOf(b1 IBlock, b2 IBlock) bool
- func (sp *Spectre) Load() error
- func (sp *Spectre) Vote(b1 IBlock, b2 IBlock) (bool, error)
- func (sp *Spectre) VoteByBlock(virtualBlock IBlock) (bool, error)
- func (sp *Spectre) Votes() map[hash.Hash]bool
- type SpectreBlock
- type SpectreBlockData
- type SyncMode
Constants ¶
const ( VMK_KEY = 1 RET_KEY = 2 )
const (
DAGErrorEmpty = "empty"
)
const (
// GHOSTDAG is an greedy algorithm implementation based on PHANTOM protocol
GHOSTDAG = "ghostdag"
)
Some available DAG algorithm types
const GenesisId = uint(0)
Genesis id of the DAG block
const MaxBlockOrder = uint(^uint32(0))
Maximum order of the DAG block
const MaxId = uint(math.MaxUint32)
Maximum id of the DAG block
const MaxMainLocatorNum = 32
This parameter can be set according to the size of TCP package(1500) to ensure the transmission stability of the network
const MaxPriority = int(math.MaxInt32)
Max Priority
const MaxTipLayerGap = 10
MaxTipLayerGap
const MaxTips = 100
Maximum number of the DAG tip
const MinBlockDataCache = 2000
block data
const MinBlockPruneSize = 2000
const StableConfirmations = 10
StableConfirmations
Variables ¶
var ( // ByteOrder is the preferred byte order used for serializing numeric // fields for storage in the database. ByteOrder = binary.LittleEndian // BlockIndexBucketName is the name of the db bucket used to house the // block which consists of metadata for all known blocks in DAG. BlockIndexBucketName = []byte("blockidx") // DagInfoBucketName is the name of the db bucket used to house the // dag information DagInfoBucketName = []byte("daginfo") // DAG Main Chain Blocks DagMainChainBucketName = []byte("dagmainchain") // OrderIdBucketName is the name of the db bucket used to house to // the block order -> block DAG Id. OrderIdBucketName = []byte("orderid") // BlockIdBucketName is the name of the db bucket used to house to // the block hash -> block DAG Id. BlockIdBucketName = []byte("blockid") // DAGTipsBucketName is the name of the db bucket used to house to // the block id -> is main chain DAGTipsBucketName = []byte("dagtips") // DiffAnticoneBucketName is the name of the db bucket used to house to // the block id DiffAnticoneBucketName = []byte("diffanticone") )
var (
BlockRate = anticone.DefaultBlockRate
)
Functions ¶
func DBGetDAGBlock ¶
DBGetDAGBlock get dag block data by resouce ID
func DBPutDAGBlock ¶
DBPutDAGBlock stores the information needed to reconstruct the provided block in the block index according to the format described above.
func DBPutDiffAnticone ¶ added in v1.0.18
diffAnticone
func GetDAGTypeByIndex ¶
func GetDAGTypeIndex ¶
func GetOrderLogStr ¶
func GetRisk ¶
func GetRisk(N int, alpha float64, lambda float64, delay float64, waitingTime uint, antiPast int) float64
parameters N: just pick a value much greater than 1. alpha: the attacker’s relative computational power. lambda: blocks per second. delay: the upper bound on the recent delay diameter in the network. waitingTime: wait time. antiPast: min(|future(x')|), where x' is x or any block in anticone(x) and x is the block we want to confirm, ideally this should be about waitingTime * lambda.
func NewDAGError ¶
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
It is the element of a DAG. It is the most basic data unit.
func (*Block) AttachChild ¶ added in v1.0.18
func (*Block) AttachParent ¶ added in v1.0.18
func (*Block) DetachChild ¶ added in v1.0.18
func (*Block) DetachParent ¶ added in v1.0.18
func (*Block) GetData ¶
func (b *Block) GetData() IBlockData
func (*Block) GetMainParent ¶
func (*Block) GetParents ¶
Get all parents set,the dag block has more than one parent
func (*Block) GetStatus ¶
func (b *Block) GetStatus() BlockStatus
func (*Block) HasChildren ¶
Detecting the presence of child nodes
func (*Block) RemoveChild ¶
func (*Block) RemoveParent ¶ added in v1.0.18
func (*Block) SetData ¶ added in v1.0.18
func (b *Block) SetData(data IBlockData)
func (*Block) SetStatusFlags ¶
func (b *Block) SetStatusFlags(flags BlockStatus)
func (*Block) UnsetStatusFlags ¶
func (b *Block) UnsetStatusFlags(flags BlockStatus)
type BlockHashSlice ¶
type BlockHashSlice []IBlock
BlockSlice is used to sort dag block Just for inside
func (BlockHashSlice) Len ¶
func (bn BlockHashSlice) Len() int
func (BlockHashSlice) Less ¶
func (bn BlockHashSlice) Less(i, j int) bool
func (BlockHashSlice) Swap ¶
func (bn BlockHashSlice) Swap(i, j int)
type BlockHeightSlice ¶
type BlockHeightSlice []IBlock
func (BlockHeightSlice) Len ¶
func (bs BlockHeightSlice) Len() int
func (BlockHeightSlice) Less ¶
func (bs BlockHeightSlice) Less(i, j int) bool
func (BlockHeightSlice) Swap ¶
func (bs BlockHeightSlice) Swap(i, j int)
type BlockOrderHelp ¶
BlockOrderHelp is used to help reorganize block order
type BlockOrderSlice ¶
type BlockOrderSlice []IBlock
BlockOrderSlice is used to sort dag block by order
func (BlockOrderSlice) Len ¶
func (bs BlockOrderSlice) Len() int
func (BlockOrderSlice) Less ¶
func (bs BlockOrderSlice) Less(i, j int) bool
func (BlockOrderSlice) Swap ¶
func (bs BlockOrderSlice) Swap(i, j int)
type BlockPrioritySlice ¶
type BlockPrioritySlice []IBlock
BlockPrioritySlice is used to sort dag block Just for inside
func (BlockPrioritySlice) Len ¶
func (bn BlockPrioritySlice) Len() int
func (BlockPrioritySlice) Less ¶
func (bn BlockPrioritySlice) Less(i, j int) bool
func (BlockPrioritySlice) Swap ¶
func (bn BlockPrioritySlice) Swap(i, j int)
type BlockSlice ¶
type BlockSlice []IBlock
BlockSlice is used to sort dag block Just for outside
func (BlockSlice) Len ¶
func (bn BlockSlice) Len() int
func (BlockSlice) Less ¶
func (bn BlockSlice) Less(i, j int) bool
func (BlockSlice) Swap ¶
func (bn BlockSlice) Swap(i, j int)
type BlockStatus ¶
type BlockStatus byte
BlockStatus
const ( // StatusNone StatusNone BlockStatus = 0 // StatusBadSide StatusBadSide BlockStatus = 1 << 0 // StatusInvalid indicates that the block data has failed validation. StatusInvalid BlockStatus = 1 << 2 )
func (BlockStatus) IsBadSide ¶
func (status BlockStatus) IsBadSide() bool
func (BlockStatus) KnownInvalid ¶
func (status BlockStatus) KnownInvalid() bool
type Conflux ¶
type Conflux struct {
// contains filtered or unexported fields
}
func (*Conflux) GetMainChain ¶
func (*Conflux) GetMainChainTip ¶
return the tip of main chain
func (*Conflux) GetMainChainTipId ¶
return the tip of main chain id
func (*Conflux) GetMainParent ¶
return the main parent in the parents
func (*Conflux) GetMainParentConcurrency ¶
The main parent concurrency of block
func (*Conflux) GetTipsList ¶
type ConsensusAlgorithm ¶
type ConsensusAlgorithm interface { // Return the name GetName() string // This instance is initialized and will be executed first. Init(bd *MeerDAG) bool // Add a block AddBlock(ib IBlock) (*list.List, *list.List) // Build self block CreateBlock(b *Block) IBlock // If the successor return nil, the underlying layer will use the default tips list. GetTipsList() []IBlock // return the tip of main chain GetMainChainTip() IBlock // return the tip of main chain id GetMainChainTipId() uint // return the main parent in the parents GetMainParent(parents *IdSet) IBlock // encode Encode(w io.Writer) error // decode Decode(r io.Reader) error // load Load() error // IsDAG IsDAG(parents []IBlock) bool // The main parent concurrency of block GetMainParentConcurrency(b IBlock) int // GetBlues GetBlues(parents *IdSet) uint // IsBlue IsBlue(id uint) bool // contains filtered or unexported methods }
The abstract inferface is used to build and manager DAG consensus algorithm
func NewBlockDAG ¶
func NewBlockDAG(dagType string) ConsensusAlgorithm
It will create different BlockDAG instances
type DAGSnapshot ¶
type DAGSnapshot struct {
// contains filtered or unexported fields
}
func NewDAGSnapshot ¶
func NewDAGSnapshot() *DAGSnapshot
func (*DAGSnapshot) AddOrder ¶
func (d *DAGSnapshot) AddOrder(ib IBlock)
func (*DAGSnapshot) Clean ¶
func (d *DAGSnapshot) Clean()
func (*DAGSnapshot) IsValid ¶
func (d *DAGSnapshot) IsValid() bool
type DAGSync ¶
type DAGSync struct {
// contains filtered or unexported fields
}
func (*DAGSync) CalcSyncBlocks ¶
func (ds *DAGSync) CalcSyncBlocks(gs *GraphState, locator []*hash.Hash, mode SyncMode, maxHashes uint) ([]*hash.Hash, *hash.Hash)
CalcSyncBlocks
func (*DAGSync) GetMainLocator ¶
GetMainLocator
func (*DAGSync) SetGraphState ¶
func (ds *DAGSync) SetGraphState(gs *GraphState)
type Epoch ¶
type Epoch struct {
// contains filtered or unexported fields
}
func (*Epoch) GetSequence ¶
func (*Epoch) HasDepends ¶
type GetBlockData ¶
type GetBlockData func(*hash.Hash) IBlockData
type GhostDAG ¶ added in v1.0.18
type GhostDAG struct {
// contains filtered or unexported fields
}
func (*GhostDAG) BlockHeader ¶ added in v1.0.18
func (gd *GhostDAG) BlockHeader(dbContext model.DBReader, stagingArea *model.StagingArea, blockHash *hash.Hash) (model.BlockHeader, error)
--------------- implementation
func (*GhostDAG) BlockHeaders ¶ added in v1.0.18
func (gd *GhostDAG) BlockHeaders(dbContext model.DBReader, stagingArea *model.StagingArea, blockHashes []*hash.Hash) ([]model.BlockHeader, error)
func (*GhostDAG) ChildInSelectedParentChainOf ¶ added in v1.0.18
func (*GhostDAG) Count ¶ added in v1.0.18
func (gd *GhostDAG) Count(stagingArea *model.StagingArea) uint64
func (*GhostDAG) CreateBlock ¶ added in v1.0.18
Build self block
func (*GhostDAG) Delete ¶ added in v1.0.18
func (gd *GhostDAG) Delete(stagingArea *model.StagingArea, blockHash *hash.Hash)
func (*GhostDAG) GetBlueSet ¶ added in v1.0.18
func (*GhostDAG) GetMainChainTip ¶ added in v1.0.18
return the tip of main chain
func (*GhostDAG) GetMainChainTipId ¶ added in v1.0.18
func (*GhostDAG) GetMainParent ¶ added in v1.0.18
return the main parent in the parents
func (*GhostDAG) GetMainParentConcurrency ¶ added in v1.0.18
The main parent concurrency of block
func (*GhostDAG) GetTipsList ¶ added in v1.0.18
If the successor return nil, the underlying layer will use the default tips list.
func (*GhostDAG) HasBlockHeader ¶ added in v1.0.18
func (*GhostDAG) IsAncestorOf ¶ added in v1.0.18
func (*GhostDAG) IsAncestorOfAny ¶ added in v1.0.18
func (*GhostDAG) IsAnyAncestorOf ¶ added in v1.0.18
func (*GhostDAG) IsInSelectedParentChainOf ¶ added in v1.0.18
func (*GhostDAG) IsParentOf ¶ added in v1.0.18
func (*GhostDAG) IsStaged ¶ added in v1.0.18
func (gd *GhostDAG) IsStaged(stagingArea *model.StagingArea) bool
func (*GhostDAG) SetParents ¶ added in v1.0.18
func (*GhostDAG) Stage ¶ added in v1.0.18
func (gd *GhostDAG) Stage(stagingArea *model.StagingArea, blockHash *hash.Hash, blockGHOSTDAGData *model.BlockGHOSTDAGData, isTrustedData bool)
func (*GhostDAG) UnstageAll ¶ added in v1.0.18
func (gd *GhostDAG) UnstageAll(stagingArea *model.StagingArea)
func (*GhostDAG) UpdateOrders ¶ added in v1.0.18
It is only used to simulate the tags of all sequences, and the algorithm itself is very inefficient
type GraphState ¶
A general description of the whole state of DAG
func (*GraphState) Decode ¶
func (gs *GraphState) Decode(r io.Reader, pver uint32) error
Decode itself from bytes buff
func (*GraphState) Encode ¶
func (gs *GraphState) Encode(w io.Writer, pver uint32) error
Encode itself to bytes buff
func (*GraphState) GetMainChainTip ¶
func (gs *GraphState) GetMainChainTip() *hash.Hash
func (*GraphState) GetMainHeight ¶
func (gs *GraphState) GetMainHeight() uint
Return the height of main chain
func (*GraphState) GetMainOrder ¶
func (gs *GraphState) GetMainOrder() uint
func (*GraphState) GetTips ¶
func (gs *GraphState) GetTips() *HashSet
func (*GraphState) GetTipsList ¶
func (gs *GraphState) GetTipsList() []*hash.Hash
Return all tips of DAG
func (*GraphState) IsEqual ¶
func (gs *GraphState) IsEqual(other *GraphState) bool
Judging whether it is equal to other
func (*GraphState) IsExcellent ¶
func (gs *GraphState) IsExcellent(other *GraphState) bool
Judging whether it is better than other
func (*GraphState) IsGenesis ¶
func (gs *GraphState) IsGenesis() bool
func (*GraphState) MaxPayloadLength ¶
func (gs *GraphState) MaxPayloadLength() uint32
func (*GraphState) SetLayer ¶
func (gs *GraphState) SetLayer(layer uint)
func (*GraphState) SetMainHeight ¶
func (gs *GraphState) SetMainHeight(mainHeight uint)
func (*GraphState) SetMainOrder ¶
func (gs *GraphState) SetMainOrder(order uint)
func (*GraphState) SetTips ¶
func (gs *GraphState) SetTips(tips []*hash.Hash)
func (*GraphState) SetTotal ¶
func (gs *GraphState) SetTotal(total uint)
type HashSet ¶
type HashSet struct {
// contains filtered or unexported fields
}
On the Set of hash, and the saved data can be of any type
func (*HashSet) Intersection ¶
This function returns a new open memory (HashSet) The intersection of a set
type IBlock ¶
type IBlock interface { // Return block ID GetID() uint // Return the hash of block. It will be a pointer. GetHash() *hash.Hash // Acquire the layer of block GetLayer() uint // Setting the order of block SetOrder(o uint) // Acquire the order of block GetOrder() uint // IsOrdered IsOrdered() bool AddParent(parent IBlock) // Get all parents set,the dag block has more than one parent GetParents() *IdSet // Testing whether it has parents HasParents() bool // Add child nodes to block AddChild(child IBlock) // Get all the children of block GetChildren() *IdSet // Detecting the presence of child nodes HasChildren() bool RemoveChild(child uint) // GetMainParent GetMainParent() uint // Setting the weight of block SetWeight(weight uint64) // Acquire the weight of block GetWeight() uint64 // Acquire the height of block in main chain GetHeight() uint // SetStatus SetStatus(status BlockStatus) // GetStatus GetStatus() BlockStatus // encode Encode(w io.Writer) error // decode Decode(r io.Reader) error // block data GetData() IBlockData SetData(data IBlockData) IsLoaded() bool // valid block data Valid() // invalid block data Invalid() AttachParent(ib IBlock) DetachParent(ib IBlock) AttachChild(ib IBlock) DetachChild(ib IBlock) }
The interface of block
type IBlockData ¶
type IBlockData interface { // Get hash of block GetHash() *hash.Hash // Get all parents set,the dag block has more than one parent GetParents() []*hash.Hash // Timestamp GetTimestamp() int64 // Priority GetPriority() int }
The abstract inferface is used to dag block
type IdSet ¶
type IdSet struct {
// contains filtered or unexported fields
}
On the Set of hash, and the saved data can be of any type
func (*IdSet) Intersection ¶
This function returns a new open memory (IdSet) The intersection of a set
func (*IdSet) IsDataEmpty ¶ added in v1.0.18
func (*IdSet) SortHashList ¶
Value must be ensured
func (*IdSet) SortHeightList ¶
func (*IdSet) SortPriorityList ¶
type LazySet ¶
type LazySet struct {
// contains filtered or unexported fields
}
A collection that tries to imitate "lazy" operations
func (*LazySet) Intersection ¶
A collection consisting of all elements belonging to set self and other.
type MainChain ¶
type MainChain struct {
// contains filtered or unexported fields
}
The main chain of DAG is support incremental expansion
type MeerDAG ¶
The general foundation framework of Block DAG implement
func New ¶ added in v1.0.18
func New(dagType string, calcWeight CalcWeight, blockRate float64, db database.DB, getBlockData GetBlockData) *MeerDAG
func (*MeerDAG) AddBlock ¶
This is an entry for update the block dag,you need pass in a block parameter, If add block have failure,it will return false.
func (*MeerDAG) BuildMerkleTreeStoreFromTips ¶
build merkle tree form current DAG tips
func (*MeerDAG) CheckBlueAndMature ¶
Batch check the blue and mature properties of blocks in views perspective. targets: Need check blocks views: Block DAG perspective when calculate the result max: Max maturity
func (*MeerDAG) CheckBlueAndMatureMT ¶
Batch check the blue and mature properties of blocks in views perspective, and enable multithreading mode. targets: Need check blocks views: Block DAG perspective when calculate the result max: Max maturity
func (*MeerDAG) CheckMainBlueAndMature ¶
func (bd *MeerDAG) CheckMainBlueAndMature(target IBlock, targetMainFork IBlock, max uint) (bool, IBlock)
processMaturity
func (*MeerDAG) CheckSubMainChainTip ¶
Checking the sub main chain for the parents of tip
func (*MeerDAG) CreateVirtualBlock ¶
func (bd *MeerDAG) CreateVirtualBlock(data IBlockData) IBlock
Just for custom Virtual block
func (*MeerDAG) GetBlockById ¶
Acquire one block by hash
func (*MeerDAG) GetBlockByOrder ¶
func (*MeerDAG) GetBlockCacheSize ¶ added in v1.0.18
func (*MeerDAG) GetBlockConcurrency ¶
GetBlockConcurrency : Temporarily use blue set of the past blocks as the criterion
func (*MeerDAG) GetBlockData ¶ added in v1.0.18
func (bd *MeerDAG) GetBlockData(ib IBlock) IBlockData
func (*MeerDAG) GetBlockDataCacheSize ¶ added in v1.0.18
func (*MeerDAG) GetBlockHashByOrder ¶
Obtain block hash by global order
func (*MeerDAG) GetBlueInfo ¶
func (*MeerDAG) GetBluesByBlock ¶
func (*MeerDAG) GetChildren ¶ added in v1.0.18
func (*MeerDAG) GetConfirmations ¶
GetConfirmations
func (*MeerDAG) GetGenesisHash ¶
Acquire the genesis block hash of chain
func (*MeerDAG) GetGraphState ¶
func (bd *MeerDAG) GetGraphState() *GraphState
Return current general description of the whole state of DAG
func (*MeerDAG) GetLastTime ¶
The last time is when add one block to DAG.
func (*MeerDAG) GetLayer ¶
Return the layer of block,it is stable. You can imagine that this is the main chain.
func (*MeerDAG) GetMainAncestor ¶
func (*MeerDAG) GetMainChainTip ¶
return the tip of main chain
func (*MeerDAG) GetMainParent ¶
return the main parent in the parents
func (*MeerDAG) GetMainParentAndList ¶
func (*MeerDAG) GetMainParentByHashs ¶
return the main parent in the parents
func (*MeerDAG) GetMainParentConcurrency ¶
The main parent concurrency of block
func (*MeerDAG) GetMaturity ¶
GetMaturity
func (*MeerDAG) GetMinBlockCacheSize ¶ added in v1.0.18
func (*MeerDAG) GetMinBlockDataCacheSize ¶ added in v1.0.18
func (*MeerDAG) GetParents ¶ added in v1.0.18
func (*MeerDAG) GetParentsMaxLayer ¶
func (*MeerDAG) GetPrevious ¶
This function need a stable sequence,so call it before sorting the DAG. If the h is invalid,the function will become a little inefficient.
func (*MeerDAG) GetTips ¶
return the terminal blocks, because there maybe more than one, so this is a set.
func (*MeerDAG) GetTipsList ¶
Acquire the tips array of DAG
func (*MeerDAG) HasBlockById ¶
Is there a block in DAG?
func (*MeerDAG) HasLoadedBlock ¶ added in v1.0.18
func (*MeerDAG) InvalidBlock ¶
func (*MeerDAG) IsHourglass ¶
func (*MeerDAG) IsOnMainChain ¶
Query whether a given block is on the main chain. Note that some DAG protocols may not support this feature.
func (*MeerDAG) LoadBlockDataSet ¶ added in v1.0.18
func (*MeerDAG) RelativeMainAncestor ¶
func (*MeerDAG) SetCacheSize ¶ added in v1.0.18
func (*MeerDAG) SetTipsDisLimit ¶
func (*MeerDAG) UpdateWeight ¶
func (*MeerDAG) UpgradeDB ¶
func (bd *MeerDAG) UpgradeDB(dbTx database.Tx, mainTip *hash.Hash, total uint64, genesis *hash.Hash, fortips bool, interrupt <-chan struct{}) error
update db to new version
func (*MeerDAG) ValidBlock ¶
type OldBlock ¶ added in v1.0.18
type OldBlock struct {
// contains filtered or unexported fields
}
func (*OldBlock) AttachChild ¶ added in v1.0.18
func (*OldBlock) AttachParent ¶ added in v1.0.18
func (*OldBlock) DetachChild ¶ added in v1.0.18
func (*OldBlock) DetachParent ¶ added in v1.0.18
func (*OldBlock) GetBackParent ¶ added in v1.0.18
func (*OldBlock) GetChildren ¶ added in v1.0.18
func (*OldBlock) GetData ¶ added in v1.0.18
func (b *OldBlock) GetData() IBlockData
func (*OldBlock) GetForwardParent ¶ added in v1.0.18
func (*OldBlock) GetMainParent ¶ added in v1.0.18
func (*OldBlock) GetParents ¶ added in v1.0.18
func (*OldBlock) GetStatus ¶ added in v1.0.18
func (b *OldBlock) GetStatus() BlockStatus
func (*OldBlock) HasChildren ¶ added in v1.0.18
func (*OldBlock) HasParents ¶ added in v1.0.18
func (*OldBlock) RemoveChild ¶ added in v1.0.18
func (*OldBlock) SetData ¶ added in v1.0.18
func (b *OldBlock) SetData(data IBlockData)
func (*OldBlock) SetStatus ¶ added in v1.0.18
func (b *OldBlock) SetStatus(status BlockStatus)
SetStatus
func (*OldBlock) SetStatusFlags ¶ added in v1.0.18
func (b *OldBlock) SetStatusFlags(flags BlockStatus)
func (*OldBlock) UnsetStatusFlags ¶ added in v1.0.18
func (b *OldBlock) UnsetStatusFlags(flags BlockStatus)
type OldPhantomBlock ¶ added in v1.0.18
type OldPhantomBlock struct { *OldBlock // contains filtered or unexported fields }
old block
func (*OldPhantomBlock) AddPairBlueDiffAnticone ¶ added in v1.0.18
func (pb *OldPhantomBlock) AddPairBlueDiffAnticone(id uint, order uint)
func (*OldPhantomBlock) AddPairRedDiffAnticone ¶ added in v1.0.18
func (pb *OldPhantomBlock) AddPairRedDiffAnticone(id uint, order uint)
func (*OldPhantomBlock) Decode ¶ added in v1.0.18
func (pb *OldPhantomBlock) Decode(r io.Reader) error
decode
func (*OldPhantomBlock) Encode ¶ added in v1.0.18
func (pb *OldPhantomBlock) Encode(w io.Writer) error
encode
func (*OldPhantomBlock) GetBlueDiffAnticoneSize ¶ added in v1.0.18
func (pb *OldPhantomBlock) GetBlueDiffAnticoneSize() int
func (*OldPhantomBlock) IsBluer ¶ added in v1.0.18
func (pb *OldPhantomBlock) IsBluer(other *OldPhantomBlock) bool
type Phantom ¶
type Phantom struct {
// contains filtered or unexported fields
}
func (*Phantom) CheckBlockOrderDB ¶ added in v1.0.18
func (*Phantom) CheckMainChainDB ¶
func (*Phantom) GetDiffAnticone ¶
func (*Phantom) GetDiffBlueSet ¶
func (*Phantom) GetMainChainTip ¶
return the tip of main chain
func (*Phantom) GetMainChainTipId ¶
func (*Phantom) GetMainParent ¶
return the main parent in the parents
func (*Phantom) GetMainParentConcurrency ¶
The main parent concurrency of block
func (*Phantom) GetTipsList ¶
If the successor return nil, the underlying layer will use the default tips list.
func (*Phantom) UpdateVirtualBlockOrder ¶
func (ph *Phantom) UpdateVirtualBlockOrder() *PhantomBlock
func (*Phantom) UpdateWeight ¶
type PhantomBlock ¶
type PhantomBlock struct { *Block // contains filtered or unexported fields }
func (*PhantomBlock) AddBlueDiffAnticone ¶ added in v1.0.18
func (pb *PhantomBlock) AddBlueDiffAnticone(id uint)
func (*PhantomBlock) AddPairBlueDiffAnticone ¶ added in v1.0.18
func (pb *PhantomBlock) AddPairBlueDiffAnticone(id uint, order uint)
func (*PhantomBlock) AddPairRedDiffAnticone ¶ added in v1.0.18
func (pb *PhantomBlock) AddPairRedDiffAnticone(id uint, order uint)
func (*PhantomBlock) AddRedDiffAnticone ¶ added in v1.0.18
func (pb *PhantomBlock) AddRedDiffAnticone(id uint)
func (*PhantomBlock) CleanDiffAnticone ¶ added in v1.0.18
func (pb *PhantomBlock) CleanDiffAnticone()
func (*PhantomBlock) GetBlueDiffAnticone ¶
func (pb *PhantomBlock) GetBlueDiffAnticone() *IdSet
func (*PhantomBlock) GetBlueDiffAnticoneSize ¶ added in v1.0.18
func (pb *PhantomBlock) GetBlueDiffAnticoneSize() int
func (*PhantomBlock) GetDiffAnticoneSize ¶ added in v1.0.18
func (pb *PhantomBlock) GetDiffAnticoneSize() int
func (*PhantomBlock) GetRedDiffAnticone ¶
func (pb *PhantomBlock) GetRedDiffAnticone() *IdSet
func (*PhantomBlock) GetRedDiffAnticoneSize ¶ added in v1.0.18
func (pb *PhantomBlock) GetRedDiffAnticoneSize() int
func (*PhantomBlock) HasBlueDiffAnticone ¶ added in v1.0.18
func (pb *PhantomBlock) HasBlueDiffAnticone(id uint) bool
func (*PhantomBlock) HasRedDiffAnticone ¶ added in v1.0.18
func (pb *PhantomBlock) HasRedDiffAnticone(id uint) bool
func (*PhantomBlock) IsBluer ¶
func (pb *PhantomBlock) IsBluer(other *PhantomBlock) bool
type Spectre ¶
type Spectre struct {
// contains filtered or unexported fields
}
func (*Spectre) GetMainChainTip ¶
return the tip of main chain
func (*Spectre) GetMainChainTipId ¶
func (*Spectre) GetMainParent ¶
return the main parent in the parents
func (*Spectre) GetMainParentConcurrency ¶
The main parent concurrency of block
func (*Spectre) GetTipsList ¶
func (*Spectre) IsInPastOf ¶
TODO: test if there is ancestor-descendant relationship between b1 and b2
func (*Spectre) VoteByBlock ¶
If virtual block is nil, it is like an imaginary recent coming node which references all the tips and the whole graph is its past set, otherwise it means that some real block is the virtual block of its own past set
type SpectreBlock ¶
type SpectreBlock struct {
Votes1, Votes2 int // votes in future set, -1 means not voted yet
// contains filtered or unexported fields
}
func (*SpectreBlock) GetHash ¶
func (sb *SpectreBlock) GetHash() *hash.Hash
type SpectreBlockData ¶
type SpectreBlockData struct {
// contains filtered or unexported fields
}
func (*SpectreBlockData) GetHash ¶
func (sd *SpectreBlockData) GetHash() *hash.Hash
func (*SpectreBlockData) GetParents ¶
func (sd *SpectreBlockData) GetParents() []*hash.Hash
func (*SpectreBlockData) GetPriority ¶
func (sd *SpectreBlockData) GetPriority() int
func (*SpectreBlockData) GetTimestamp ¶
func (sd *SpectreBlockData) GetTimestamp() int64
func (*SpectreBlockData) GetWeight ¶
func (sd *SpectreBlockData) GetWeight() uint64
Acquire the weight of block
Source Files ¶
- block.go
- blockblue.go
- blockpersist.go
- blockslice.go
- blocktransf.go
- blueinfo.go
- bluematurity.go
- conflux.go
- dagsnapshot.go
- dagsync.go
- dbhelper.go
- dbnamespace.go
- ghostdag.go
- graphstate.go
- hashset.go
- hashslice.go
- idset.go
- idslice.go
- lazyset.go
- log.go
- meerdag.go
- pantomblock.go
- phantom.go
- phantomblockslice.go
- spectre.go
- spectreblock.go
- spectrerisk.go
- tips.go
- upgradedb.go