mirror of
https://github.com/kaspanet/kaspad.git
synced 2026-02-27 13:43:19 +00:00
Compare commits
2 Commits
v0.9.0-rc1
...
rm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c198a3839e | ||
|
|
2cf101de6a |
@@ -193,14 +193,25 @@ func (csm *consensusStateManager) selectVirtualSelectedParent(
|
||||
}
|
||||
}
|
||||
|
||||
func (csm *consensusStateManager) mergeSetIncrease(
|
||||
candidate *externalapi.DomainHash, selectedVirtualParents []*externalapi.DomainHash, mergeSetSize uint64) (canBeParent bool, newCandidate *externalapi.DomainHash, mergeSetIncrease uint64, err error) {
|
||||
|
||||
// mergeSetIncrease returns different things depending on the result:
|
||||
// If the candidate can be a virtual parent then canBeParent=true and mergeSetIncrease=The increase in merge set size
|
||||
// If the candidate can't be a virtual parent, then canBeParent=false and newCandidate is a new proposed candidate in the past of candidate.
|
||||
func (csm *consensusStateManager) mergeSetIncrease(candidate *externalapi.DomainHash, selectedVirtualParents []*externalapi.DomainHash, mergeSetSize uint64,
|
||||
) (canBeParent bool, newCandidate *externalapi.DomainHash, mergeSetIncrease uint64, err error) {
|
||||
onEnd := logger.LogAndMeasureExecutionTime(log, "mergeSetIncrease")
|
||||
defer onEnd()
|
||||
|
||||
visited := hashset.New()
|
||||
queue := []*externalapi.DomainHash{candidate}
|
||||
// Start with the parents in the queue as we already know the candidate isn't an ancestor of the parents.
|
||||
parents, err := csm.dagTopologyManager.Parents(candidate)
|
||||
if err != nil {
|
||||
return false, nil, 0, err
|
||||
}
|
||||
for _, parent := range parents {
|
||||
visited.Add(parent)
|
||||
}
|
||||
queue := parents
|
||||
mergeSetIncrease = uint64(1) // starts with 1 for the candidate itself
|
||||
|
||||
var current *externalapi.DomainHash
|
||||
|
||||
@@ -390,6 +390,9 @@ func (dt *DAGTopologyManagerImpl) IsAncestorOf(hashBlockA *externalapi.DomainHas
|
||||
func (dt *DAGTopologyManagerImpl) IsAncestorOfAny(blockHash *externalapi.DomainHash, potentialDescendants []*externalapi.DomainHash) (bool, error) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
func (dt *DAGTopologyManagerImpl) IsAnyAncestorOf([]*externalapi.DomainHash, *externalapi.DomainHash) (bool, error) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
func (dt *DAGTopologyManagerImpl) IsInSelectedParentChainOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user