Documentation ¶
Index ¶
- Variables
- type AcceptanceDataStore
- type BlockBuilder
- type BlockGHOSTDAGData
- func (bgd *BlockGHOSTDAGData) BlueScore() uint64
- func (bgd *BlockGHOSTDAGData) BlueWork() *big.Int
- func (bgd *BlockGHOSTDAGData) BluesAnticoneSizes() map[externalapi.DomainHash]KType
- func (bgd *BlockGHOSTDAGData) MergeSet() []*externalapi.DomainHash
- func (bgd *BlockGHOSTDAGData) MergeSetBlues() []*externalapi.DomainHash
- func (bgd *BlockGHOSTDAGData) MergeSetReds() []*externalapi.DomainHash
- func (bgd *BlockGHOSTDAGData) SelectedParent() *externalapi.DomainHash
- type BlockHeaderStore
- type BlockHeap
- type BlockIterator
- type BlockProcessor
- type BlockRelationStore
- type BlockRelations
- type BlockStatusStore
- type BlockStore
- type BlockValidator
- type CoinbaseManager
- type ConsensusStateManager
- type ConsensusStateStore
- type DAGTopologyManager
- type DAGTraversalManager
- type DBBucket
- type DBCursor
- type DBKey
- type DBManager
- type DBReader
- type DBTransaction
- type DBWriter
- type DifficultyManager
- type FinalityManager
- type FinalityStore
- type FutureCoveringTreeNodeSet
- type GHOSTDAGDataStore
- type GHOSTDAGManager
- type HeaderSelectedTipStore
- type HeadersSelectedChainStore
- type HeadersSelectedTipManager
- type KType
- type MergeDepthManager
- type Multiset
- type MultisetStore
- type MutableReachabilityData
- type PastMedianTimeManager
- type PruningManager
- type PruningStore
- type ReachabilityData
- type ReachabilityDataStore
- type ReachabilityInterval
- type ReachabilityManager
- type Store
- type SyncManager
- type TransactionValidator
- type UTXODiffStore
Constants ¶
This section is empty.
Variables ¶
var ErrBlockNotInSelectedParentChain = errors.New("Block is not in selected parent chain")
ErrBlockNotInSelectedParentChain is returned from CreateHeadersSelectedChainBlockLocator if one of the parameters passed to it are not in the headers selected parent chain
var VirtualBlockHash = externalapi.NewDomainHashFromByteArray(&[externalapi.DomainHashSize]byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
})
VirtualBlockHash is a marker hash for the virtual block
Functions ¶
This section is empty.
Types ¶
type AcceptanceDataStore ¶
type AcceptanceDataStore interface { Store Stage(blockHash *externalapi.DomainHash, acceptanceData externalapi.AcceptanceData) IsStaged() bool Get(dbContext DBReader, blockHash *externalapi.DomainHash) (externalapi.AcceptanceData, error) Delete(blockHash *externalapi.DomainHash) }
AcceptanceDataStore represents a store of AcceptanceData
type BlockBuilder ¶
type BlockBuilder interface {
BuildBlock(coinbaseData *externalapi.DomainCoinbaseData, transactions []*externalapi.DomainTransaction) (*externalapi.DomainBlock, error)
}
BlockBuilder is responsible for creating blocks from the current state
type BlockGHOSTDAGData ¶
type BlockGHOSTDAGData struct {
// contains filtered or unexported fields
}
BlockGHOSTDAGData represents GHOSTDAG data for some block
func NewBlockGHOSTDAGData ¶
func NewBlockGHOSTDAGData( blueScore uint64, blueWork *big.Int, selectedParent *externalapi.DomainHash, mergeSetBlues []*externalapi.DomainHash, mergeSetReds []*externalapi.DomainHash, bluesAnticoneSizes map[externalapi.DomainHash]KType) *BlockGHOSTDAGData
NewBlockGHOSTDAGData creates a new instance of BlockGHOSTDAGData
func (*BlockGHOSTDAGData) BlueScore ¶
func (bgd *BlockGHOSTDAGData) BlueScore() uint64
BlueScore returns the BlueScore of the block
func (*BlockGHOSTDAGData) BlueWork ¶
func (bgd *BlockGHOSTDAGData) BlueWork() *big.Int
BlueWork returns the BlueWork of the block
func (*BlockGHOSTDAGData) BluesAnticoneSizes ¶
func (bgd *BlockGHOSTDAGData) BluesAnticoneSizes() map[externalapi.DomainHash]KType
BluesAnticoneSizes returns a map between the blocks in its MergeSetBlues and the size of their anticone
func (*BlockGHOSTDAGData) MergeSet ¶
func (bgd *BlockGHOSTDAGData) MergeSet() []*externalapi.DomainHash
MergeSet returns the whole MergeSet of the block (equivalent to MergeSetBlues+MergeSetReds)
func (*BlockGHOSTDAGData) MergeSetBlues ¶
func (bgd *BlockGHOSTDAGData) MergeSetBlues() []*externalapi.DomainHash
MergeSetBlues returns the MergeSetBlues of the block (not a copy)
func (*BlockGHOSTDAGData) MergeSetReds ¶
func (bgd *BlockGHOSTDAGData) MergeSetReds() []*externalapi.DomainHash
MergeSetReds returns the MergeSetReds of the block (not a copy)
func (*BlockGHOSTDAGData) SelectedParent ¶
func (bgd *BlockGHOSTDAGData) SelectedParent() *externalapi.DomainHash
SelectedParent returns the SelectedParent of the block
type BlockHeaderStore ¶
type BlockHeaderStore interface { Store Stage(blockHash *externalapi.DomainHash, blockHeader externalapi.BlockHeader) IsStaged() bool BlockHeader(dbContext DBReader, blockHash *externalapi.DomainHash) (externalapi.BlockHeader, error) HasBlockHeader(dbContext DBReader, blockHash *externalapi.DomainHash) (bool, error) BlockHeaders(dbContext DBReader, blockHashes []*externalapi.DomainHash) ([]externalapi.BlockHeader, error) Delete(blockHash *externalapi.DomainHash) Count() uint64 }
BlockHeaderStore represents a store of block headers
type BlockHeap ¶
type BlockHeap interface { Push(blockHash *externalapi.DomainHash) error PushSlice(blockHash []*externalapi.DomainHash) error Pop() *externalapi.DomainHash Len() int ToSlice() []*externalapi.DomainHash }
BlockHeap represents a heap of block hashes, providing a priority-queue functionality
type BlockIterator ¶
type BlockIterator interface { First() bool Next() bool Get() (*externalapi.DomainHash, error) Close() error }
BlockIterator is an iterator over blocks according to some order.
type BlockProcessor ¶
type BlockProcessor interface { ValidateAndInsertBlock(block *externalapi.DomainBlock) (*externalapi.BlockInsertionResult, error) ValidateAndInsertImportedPruningPoint(newPruningPoint *externalapi.DomainBlock) error }
BlockProcessor is responsible for processing incoming blocks
type BlockRelationStore ¶
type BlockRelationStore interface { Store StageBlockRelation(blockHash *externalapi.DomainHash, blockRelations *BlockRelations) IsStaged() bool BlockRelation(dbContext DBReader, blockHash *externalapi.DomainHash) (*BlockRelations, error) Has(dbContext DBReader, blockHash *externalapi.DomainHash) (bool, error) }
BlockRelationStore represents a store of BlockRelations
type BlockRelations ¶
type BlockRelations struct { Parents []*externalapi.DomainHash Children []*externalapi.DomainHash }
BlockRelations represents a block's parent/child relations
func (*BlockRelations) Clone ¶
func (br *BlockRelations) Clone() *BlockRelations
Clone returns a clone of BlockRelations
func (*BlockRelations) Equal ¶
func (br *BlockRelations) Equal(other *BlockRelations) bool
Equal returns whether br equals to other
type BlockStatusStore ¶
type BlockStatusStore interface { Store Stage(blockHash *externalapi.DomainHash, blockStatus externalapi.BlockStatus) IsStaged() bool Get(dbContext DBReader, blockHash *externalapi.DomainHash) (externalapi.BlockStatus, error) Exists(dbContext DBReader, blockHash *externalapi.DomainHash) (bool, error) }
BlockStatusStore represents a store of BlockStatuses
type BlockStore ¶
type BlockStore interface { Store Stage(blockHash *externalapi.DomainHash, block *externalapi.DomainBlock) IsStaged() bool Block(dbContext DBReader, blockHash *externalapi.DomainHash) (*externalapi.DomainBlock, error) HasBlock(dbContext DBReader, blockHash *externalapi.DomainHash) (bool, error) Blocks(dbContext DBReader, blockHashes []*externalapi.DomainHash) ([]*externalapi.DomainBlock, error) Delete(blockHash *externalapi.DomainHash) Count() uint64 AllBlockHashesIterator(dbContext DBReader) (BlockIterator, error) }
BlockStore represents a store of blocks
type BlockValidator ¶
type BlockValidator interface { ValidateHeaderInIsolation(blockHash *externalapi.DomainHash) error ValidateBodyInIsolation(blockHash *externalapi.DomainHash) error ValidateHeaderInContext(blockHash *externalapi.DomainHash) error ValidateBodyInContext(blockHash *externalapi.DomainHash, isPruningPoint bool) error ValidatePruningPointViolationAndProofOfWorkAndDifficulty(blockHash *externalapi.DomainHash) error }
BlockValidator exposes a set of validation classes, after which it's possible to determine whether a block is valid
type CoinbaseManager ¶
type CoinbaseManager interface { ExpectedCoinbaseTransaction(blockHash *externalapi.DomainHash, coinbaseData *externalapi.DomainCoinbaseData) (*externalapi.DomainTransaction, error) ExtractCoinbaseDataAndBlueScore(coinbaseTx *externalapi.DomainTransaction) (blueScore uint64, coinbaseData *externalapi.DomainCoinbaseData, err error) }
CoinbaseManager exposes methods for handling blocks' coinbase transactions
type ConsensusStateManager ¶
type ConsensusStateManager interface { AddBlock(blockHash *externalapi.DomainHash) (*externalapi.SelectedChainPath, externalapi.UTXODiff, error) PopulateTransactionWithUTXOEntries(transaction *externalapi.DomainTransaction) error ImportPruningPoint(newPruningPoint *externalapi.DomainBlock) error RestorePastUTXOSetIterator(blockHash *externalapi.DomainHash) (externalapi.ReadOnlyUTXOSetIterator, error) CalculatePastUTXOAndAcceptanceData(blockHash *externalapi.DomainHash) (externalapi.UTXODiff, externalapi.AcceptanceData, Multiset, error) GetVirtualSelectedParentChainFromBlock(blockHash *externalapi.DomainHash) (*externalapi.SelectedChainPath, error) RecoverUTXOIfRequired() error }
ConsensusStateManager manages the node's consensus state
type ConsensusStateStore ¶
type ConsensusStateStore interface { Store IsStaged() bool StageVirtualUTXODiff(virtualUTXODiff externalapi.UTXODiff) UTXOByOutpoint(dbContext DBReader, outpoint *externalapi.DomainOutpoint) (externalapi.UTXOEntry, error) HasUTXOByOutpoint(dbContext DBReader, outpoint *externalapi.DomainOutpoint) (bool, error) VirtualUTXOSetIterator(dbContext DBReader) (externalapi.ReadOnlyUTXOSetIterator, error) VirtualUTXOs(dbContext DBReader, fromOutpoint *externalapi.DomainOutpoint, limit int) ([]*externalapi.OutpointAndUTXOEntryPair, error) StageTips(tipHashes []*externalapi.DomainHash) Tips(dbContext DBReader) ([]*externalapi.DomainHash, error) StartImportingPruningPointUTXOSet(dbContext DBWriter) error HadStartedImportingPruningPointUTXOSet(dbContext DBWriter) (bool, error) ImportPruningPointUTXOSetIntoVirtualUTXOSet(dbContext DBWriter, pruningPointUTXOSetIterator externalapi.ReadOnlyUTXOSetIterator) error FinishImportingPruningPointUTXOSet(dbContext DBWriter) error }
ConsensusStateStore represents a store for the current consensus state
type DAGTopologyManager ¶
type DAGTopologyManager interface { Parents(blockHash *externalapi.DomainHash) ([]*externalapi.DomainHash, error) Children(blockHash *externalapi.DomainHash) ([]*externalapi.DomainHash, error) IsParentOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error) IsChildOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error) IsAncestorOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error) IsAncestorOfAny(blockHash *externalapi.DomainHash, potentialDescendants []*externalapi.DomainHash) (bool, error) IsAnyAncestorOf(potentialAncestors []*externalapi.DomainHash, blockHash *externalapi.DomainHash) (bool, error) IsInSelectedParentChainOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error) ChildInSelectedParentChainOf(context, highHash *externalapi.DomainHash) (*externalapi.DomainHash, error) SetParents(blockHash *externalapi.DomainHash, parentHashes []*externalapi.DomainHash) error }
DAGTopologyManager exposes methods for querying relationships between blocks in the DAG
type DAGTraversalManager ¶
type DAGTraversalManager interface { BlockAtDepth(highHash *externalapi.DomainHash, depth uint64) (*externalapi.DomainHash, error) LowestChainBlockAboveOrEqualToBlueScore(highHash *externalapi.DomainHash, blueScore uint64) (*externalapi.DomainHash, error) // SelectedChildIterator should return a BlockIterator that iterates // from lowHash (exclusive) to highHash (inclusive) over highHash's selected parent chain SelectedChildIterator(highHash, lowHash *externalapi.DomainHash) (BlockIterator, error) Anticone(blockHash *externalapi.DomainHash) ([]*externalapi.DomainHash, error) BlockWindow(highHash *externalapi.DomainHash, windowSize int) ([]*externalapi.DomainHash, error) NewDownHeap() BlockHeap NewUpHeap() BlockHeap CalculateChainPath( fromBlockHash, toBlockHash *externalapi.DomainHash) (*externalapi.SelectedChainPath, error) }
DAGTraversalManager exposes methods for traversing blocks in the DAG
type DBBucket ¶
type DBBucket interface { Bucket(bucketBytes []byte) DBBucket Key(suffix []byte) DBKey Path() []byte }
DBBucket is an interface for a database bucket
type DBCursor ¶
type DBCursor interface { // Next moves the iterator to the next key/value pair. It returns whether the // iterator is exhausted. Panics if the cursor is closed. Next() bool // First moves the iterator to the first key/value pair. It returns false if // such a pair does not exist. Panics if the cursor is closed. First() bool // Seek moves the iterator to the first key/value pair whose key is greater // than or equal to the given key. It returns ErrNotFound if such pair does not // exist. Seek(key DBKey) error // Key returns the key of the current key/value pair, or ErrNotFound if done. // The caller should not modify the contents of the returned key, and // its contents may change on the next call to Next. Key() (DBKey, error) // Value returns the value of the current key/value pair, or ErrNotFound if done. // The caller should not modify the contents of the returned slice, and its // contents may change on the next call to Next. Value() ([]byte, error) // Close releases associated resources. Close() error }
DBCursor iterates over database entries given some bucket.
type DBManager ¶
type DBManager interface { DBWriter // Begin begins a new database transaction. Begin() (DBTransaction, error) }
DBManager defines the interface of a database that can begin transactions and read data.
type DBReader ¶
type DBReader interface { // Get gets the value for the given key. It returns // ErrNotFound if the given key does not exist. Get(key DBKey) ([]byte, error) // Has returns true if the database does contains the // given key. Has(key DBKey) (bool, error) // Cursor begins a new cursor over the given bucket. Cursor(bucket DBBucket) (DBCursor, error) }
DBReader defines a proxy over domain data access
type DBTransaction ¶
type DBTransaction interface { DBWriter // Rollback rolls back whatever changes were made to the // database within this transaction. Rollback() error // Commit commits whatever changes were made to the database // within this transaction. Commit() error // RollbackUnlessClosed rolls back changes that were made to // the database within the transaction, unless the transaction // had already been closed using either Rollback or Commit. RollbackUnlessClosed() error }
DBTransaction is a proxy over domain data access that requires an open database transaction
type DBWriter ¶
type DBWriter interface { DBReader // Put sets the value for the given key. It overwrites // any previous value for that key. Put(key DBKey, value []byte) error // Delete deletes the value for the given key. Will not // return an error if the key doesn't exist. Delete(key DBKey) error }
DBWriter is an interface to write to the database
type DifficultyManager ¶
type DifficultyManager interface {
RequiredDifficulty(blockHash *externalapi.DomainHash) (uint32, error)
}
DifficultyManager provides a method to resolve the difficulty value of a block
type FinalityManager ¶
type FinalityManager interface { VirtualFinalityPoint() (*externalapi.DomainHash, error) FinalityPoint(blockHash *externalapi.DomainHash) (*externalapi.DomainHash, error) }
FinalityManager provides method to validate that a block does not violate finality
type FinalityStore ¶
type FinalityStore interface { Store IsStaged() bool StageFinalityPoint(blockHash *externalapi.DomainHash, finalityPointHash *externalapi.DomainHash) FinalityPoint(dbContext DBReader, blockHash *externalapi.DomainHash) (*externalapi.DomainHash, error) }
FinalityStore represents a store for finality data
type FutureCoveringTreeNodeSet ¶
type FutureCoveringTreeNodeSet []*externalapi.DomainHash
FutureCoveringTreeNodeSet represents a collection of blocks in the future of a certain block. Once a block B is added to the DAG, every block A_i in B's selected parent anticone must register B in its FutureCoveringTreeNodeSet. This allows to relatively quickly (O(log(|FutureCoveringTreeNodeSet|))) query whether B is a descendent (is in the "future") of any block that previously registered it.
Note that FutureCoveringTreeNodeSet is meant to be queried only if B is not a reachability tree descendant of the block in question, as reachability tree queries are always O(1).
See insertNode, hasAncestorOf, and isInPast for further details.
func (FutureCoveringTreeNodeSet) Clone ¶
func (fctns FutureCoveringTreeNodeSet) Clone() FutureCoveringTreeNodeSet
Clone returns a clone of FutureCoveringTreeNodeSet
func (FutureCoveringTreeNodeSet) Equal ¶
func (fctns FutureCoveringTreeNodeSet) Equal(other FutureCoveringTreeNodeSet) bool
Equal returns whether fctns equals to other
type GHOSTDAGDataStore ¶
type GHOSTDAGDataStore interface { Store Stage(blockHash *externalapi.DomainHash, blockGHOSTDAGData *BlockGHOSTDAGData) IsStaged() bool Get(dbContext DBReader, blockHash *externalapi.DomainHash) (*BlockGHOSTDAGData, error) }
GHOSTDAGDataStore represents a store of BlockGHOSTDAGData
type GHOSTDAGManager ¶
type GHOSTDAGManager interface { GHOSTDAG(blockHash *externalapi.DomainHash) error ChooseSelectedParent(blockHashes ...*externalapi.DomainHash) (*externalapi.DomainHash, error) Less(blockHashA *externalapi.DomainHash, ghostdagDataA *BlockGHOSTDAGData, blockHashB *externalapi.DomainHash, ghostdagDataB *BlockGHOSTDAGData) bool }
GHOSTDAGManager resolves and manages GHOSTDAG block data
type HeaderSelectedTipStore ¶
type HeaderSelectedTipStore interface { Store Stage(selectedTip *externalapi.DomainHash) IsStaged() bool HeadersSelectedTip(dbContext DBReader) (*externalapi.DomainHash, error) Has(dbContext DBReader) (bool, error) }
HeaderSelectedTipStore represents a store of the headers selected tip
type HeadersSelectedChainStore ¶
type HeadersSelectedChainStore interface { Store Stage(dbContext DBReader, chainChanges *externalapi.SelectedChainPath) error IsStaged() bool GetIndexByHash(dbContext DBReader, blockHash *externalapi.DomainHash) (uint64, error) GetHashByIndex(dbContext DBReader, index uint64) (*externalapi.DomainHash, error) }
HeadersSelectedChainStore represents a store of the headers selected chain
type HeadersSelectedTipManager ¶
type HeadersSelectedTipManager interface {
AddHeaderTip(hash *externalapi.DomainHash) error
}
HeadersSelectedTipManager manages the state of the headers selected tip
type MergeDepthManager ¶
type MergeDepthManager interface { CheckBoundedMergeDepth(blockHash *externalapi.DomainHash) error NonBoundedMergeDepthViolatingBlues(blockHash *externalapi.DomainHash) ([]*externalapi.DomainHash, error) }
MergeDepthManager is used to validate mergeDepth for blocks
type Multiset ¶
type Multiset interface { Add(data []byte) Remove(data []byte) Hash() *externalapi.DomainHash Serialize() []byte Clone() Multiset }
Multiset represents a secp256k1 multiset
type MultisetStore ¶
type MultisetStore interface { Store Stage(blockHash *externalapi.DomainHash, multiset Multiset) IsStaged() bool Get(dbContext DBReader, blockHash *externalapi.DomainHash) (Multiset, error) Delete(blockHash *externalapi.DomainHash) }
MultisetStore represents a store of Multisets
type MutableReachabilityData ¶
type MutableReachabilityData interface { ReachabilityData AddChild(child *externalapi.DomainHash) SetParent(parent *externalapi.DomainHash) SetInterval(interval *ReachabilityInterval) SetFutureCoveringSet(futureCoveringSet FutureCoveringTreeNodeSet) }
MutableReachabilityData represents a block's MutableReachabilityData, with ability to edit it
type PastMedianTimeManager ¶
type PastMedianTimeManager interface {
PastMedianTime(blockHash *externalapi.DomainHash) (int64, error)
}
PastMedianTimeManager provides a method to resolve the past median time of a block
type PruningManager ¶
type PruningManager interface { UpdatePruningPointByVirtual() error IsValidPruningPoint(blockHash *externalapi.DomainHash) (bool, error) ClearImportedPruningPointData() error AppendImportedPruningPointUTXOs(outpointAndUTXOEntryPairs []*externalapi.OutpointAndUTXOEntryPair) error UpdatePruningPointUTXOSetIfRequired() error PruneAllBlocksBelow(pruningPointHash *externalapi.DomainHash) error }
PruningManager resolves and manages the current pruning point
type PruningStore ¶
type PruningStore interface { Store StagePruningPoint(pruningPointBlockHash *externalapi.DomainHash) StagePruningPointCandidate(candidate *externalapi.DomainHash) IsStaged() bool PruningPointCandidate(dbContext DBReader) (*externalapi.DomainHash, error) HasPruningPointCandidate(dbContext DBReader) (bool, error) PruningPoint(dbContext DBReader) (*externalapi.DomainHash, error) HasPruningPoint(dbContext DBReader) (bool, error) StageStartUpdatingPruningPointUTXOSet() HadStartedUpdatingPruningPointUTXOSet(dbContext DBWriter) (bool, error) FinishUpdatingPruningPointUTXOSet(dbContext DBWriter) error UpdatePruningPointUTXOSet(dbContext DBWriter, utxoSetIterator externalapi.ReadOnlyUTXOSetIterator) error ClearImportedPruningPointUTXOs(dbContext DBWriter) error AppendImportedPruningPointUTXOs(dbTx DBTransaction, outpointAndUTXOEntryPairs []*externalapi.OutpointAndUTXOEntryPair) error ImportedPruningPointUTXOIterator(dbContext DBReader) (externalapi.ReadOnlyUTXOSetIterator, error) ClearImportedPruningPointMultiset(dbContext DBWriter) error ImportedPruningPointMultiset(dbContext DBReader) (Multiset, error) UpdateImportedPruningPointMultiset(dbTx DBTransaction, multiset Multiset) error CommitImportedPruningPointUTXOSet(dbContext DBWriter) error PruningPointUTXOs(dbContext DBReader, fromOutpoint *externalapi.DomainOutpoint, limit int) ([]*externalapi.OutpointAndUTXOEntryPair, error) }
PruningStore represents a store for the current pruning state
type ReachabilityData ¶
type ReachabilityData interface { Children() []*externalapi.DomainHash Parent() *externalapi.DomainHash Interval() *ReachabilityInterval FutureCoveringSet() FutureCoveringTreeNodeSet CloneMutable() MutableReachabilityData Equal(other ReachabilityData) bool }
ReachabilityData is a read-only version of a block's MutableReachabilityData Use CloneWritable to edit the MutableReachabilityData.
type ReachabilityDataStore ¶
type ReachabilityDataStore interface { Store StageReachabilityData(blockHash *externalapi.DomainHash, reachabilityData ReachabilityData) StageReachabilityReindexRoot(reachabilityReindexRoot *externalapi.DomainHash) IsAnythingStaged() bool ReachabilityData(dbContext DBReader, blockHash *externalapi.DomainHash) (ReachabilityData, error) HasReachabilityData(dbContext DBReader, blockHash *externalapi.DomainHash) (bool, error) ReachabilityReindexRoot(dbContext DBReader) (*externalapi.DomainHash, error) }
ReachabilityDataStore represents a store of ReachabilityData
type ReachabilityInterval ¶
ReachabilityInterval represents an interval to be used within the tree reachability algorithm. See ReachabilityTreeNode for further details.
func (*ReachabilityInterval) Clone ¶
func (ri *ReachabilityInterval) Clone() *ReachabilityInterval
Clone returns a clone of ReachabilityInterval
func (*ReachabilityInterval) Equal ¶
func (ri *ReachabilityInterval) Equal(other *ReachabilityInterval) bool
Equal returns whether ri equals to other
func (*ReachabilityInterval) String ¶
func (ri *ReachabilityInterval) String() string
type ReachabilityManager ¶
type ReachabilityManager interface { AddBlock(blockHash *externalapi.DomainHash) error IsReachabilityTreeAncestorOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error) IsDAGAncestorOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error) UpdateReindexRoot(selectedTip *externalapi.DomainHash) error FindNextAncestor(descendant, ancestor *externalapi.DomainHash) (*externalapi.DomainHash, error) }
ReachabilityManager maintains a structure that allows to answer reachability queries in sub-linear time
type Store ¶
type Store interface { Discard() Commit(dbTx DBTransaction) error }
Store is a common interface for data stores
type SyncManager ¶
type SyncManager interface { GetHashesBetween(lowHash, highHash *externalapi.DomainHash, maxBlueScoreDifference uint64) ([]*externalapi.DomainHash, error) GetMissingBlockBodyHashes(highHash *externalapi.DomainHash) ([]*externalapi.DomainHash, error) CreateBlockLocator(lowHash, highHash *externalapi.DomainHash, limit uint32) (externalapi.BlockLocator, error) CreateHeadersSelectedChainBlockLocator(lowHash, highHash *externalapi.DomainHash) (externalapi.BlockLocator, error) GetSyncInfo() (*externalapi.SyncInfo, error) }
SyncManager exposes functions to support sync between kaspad nodes
type TransactionValidator ¶
type TransactionValidator interface { ValidateTransactionInIsolation(transaction *externalapi.DomainTransaction) error ValidateTransactionInContextAndPopulateMassAndFee(tx *externalapi.DomainTransaction, povBlockHash *externalapi.DomainHash, selectedParentMedianTime int64) error }
TransactionValidator exposes a set of validation classes, after which it's possible to determine whether a transaction is valid
type UTXODiffStore ¶
type UTXODiffStore interface { Store Stage(blockHash *externalapi.DomainHash, utxoDiff externalapi.UTXODiff, utxoDiffChild *externalapi.DomainHash) IsStaged() bool UTXODiff(dbContext DBReader, blockHash *externalapi.DomainHash) (externalapi.UTXODiff, error) UTXODiffChild(dbContext DBReader, blockHash *externalapi.DomainHash) (*externalapi.DomainHash, error) HasUTXODiffChild(dbContext DBReader, blockHash *externalapi.DomainHash) (bool, error) Delete(blockHash *externalapi.DomainHash) }
UTXODiffStore represents a store of UTXODiffs
Source Files ¶
- block_heap.go
- blockiterator.go
- blockrelations.go
- database.go
- errors.go
- ghostdag.go
- interface_datastructures_acceptancedatastore.go
- interface_datastructures_blockheaderstore.go
- interface_datastructures_blockrelationstore.go
- interface_datastructures_blockstatusstore.go
- interface_datastructures_blockstore.go
- interface_datastructures_consensusstatestore.go
- interface_datastructures_finalitystore.go
- interface_datastructures_ghostdagdatastore.go
- interface_datastructures_headersselectedchainstore.go
- interface_datastructures_headertipsstore.go
- interface_datastructures_multisetstore.go
- interface_datastructures_pruningstore.go
- interface_datastructures_reachabilitydatastore.go
- interface_datastructures_utxodiffstore.go
- interface_processes_blockbuilder.go
- interface_processes_blockprocessor.go
- interface_processes_blockvalidator.go
- interface_processes_coinbasemanager.go
- interface_processes_consensusstatemanager.go
- interface_processes_dagtopologymanager.go
- interface_processes_dagtraversalmanager.go
- interface_processes_difficultymanager.go
- interface_processes_finalitymanager.go
- interface_processes_ghostdagmanager.go
- interface_processes_headertipsmanager.go
- interface_processes_mergedepthmanager.go
- interface_processes_pastmediantimemanager.go
- interface_processes_pruningmanager.go
- interface_processes_reachabilitytree.go
- interface_processes_syncmanager.go
- interface_processes_transactionvalidator.go
- multiset.go
- reachabilitydata.go
- store.go
- virtual.go