mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-24 07:46:45 +00:00

* [NOD-1475] Add Stage, Discard, and Commit methods to all stores. * [NOD-1475] Simplify interfaces for processes. * [NOD-1475] Fix GHOSTDAGManager. * [NOD-1475] Simplify ChooseSelectedParent. * [NOD-1475] Remove errors from Stage functions. * [NOD-1475] Add IsStaged to all data structures. * [NOD-1475] Remove isDisqualified from CalculateConsensusStateChanges. * [NOD-1475] Add dependency from ConsensusStateManager to BlockStatusStore. * [NOD-1475] Fix a comment. * [NOD-1475] Add ReachabilityReindexRoot to reachabilityDataStore. * [NOD-1475] Fix a comment. * [NOD-1475] Rename IsStaged to IsAnythingStaged.
42 lines
1.4 KiB
Go
42 lines
1.4 KiB
Go
package reachabilitytree
|
|
|
|
import (
|
|
"github.com/kaspanet/kaspad/domain/consensus/model"
|
|
"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
|
|
)
|
|
|
|
// reachabilityTree maintains a structure that allows to answer
|
|
// reachability queries in sub-linear time
|
|
type reachabilityTree struct {
|
|
blockRelationStore model.BlockRelationStore
|
|
reachabilityDataStore model.ReachabilityDataStore
|
|
}
|
|
|
|
// New instantiates a new ReachabilityTree
|
|
func New(
|
|
blockRelationStore model.BlockRelationStore,
|
|
reachabilityDataStore model.ReachabilityDataStore) model.ReachabilityTree {
|
|
return &reachabilityTree{
|
|
blockRelationStore: blockRelationStore,
|
|
reachabilityDataStore: reachabilityDataStore,
|
|
}
|
|
}
|
|
|
|
// AddBlock adds the block with the given blockHash into the reachability tree.
|
|
func (rt *reachabilityTree) AddBlock(blockHash *externalapi.DomainHash) error {
|
|
return nil
|
|
}
|
|
|
|
// IsReachabilityTreeAncestorOf returns true if blockHashA is an
|
|
// ancestor of blockHashB in the reachability tree. Note that this
|
|
// does not necessarily mean that it isn't its ancestor in the DAG.
|
|
func (rt *reachabilityTree) IsReachabilityTreeAncestorOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error) {
|
|
return false, nil
|
|
}
|
|
|
|
// IsDAGAncestorOf returns true if blockHashA is an ancestor of
|
|
// blockHashB in the DAG.
|
|
func (rt *reachabilityTree) IsDAGAncestorOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error) {
|
|
return false, nil
|
|
}
|