Addressing review comments

This commit is contained in:
msutton 2022-07-15 12:00:23 +03:00
parent 9f9610df49
commit 4d51f4c7a7
3 changed files with 9 additions and 6 deletions

View File

@ -932,10 +932,10 @@ func (s *consensus) resolveVirtualChunkWithLock(maxBlocksToResolve uint64) (*ext
s.lock.Lock()
defer s.lock.Unlock()
return s.resolveVirtualNoLock(maxBlocksToResolve)
return s.resolveVirtualChunkNoLock(maxBlocksToResolve)
}
func (s *consensus) resolveVirtualNoLock(maxBlocksToResolve uint64) (*externalapi.VirtualChangeSet, bool, error) {
func (s *consensus) resolveVirtualChunkNoLock(maxBlocksToResolve uint64) (*externalapi.VirtualChangeSet, bool, error) {
virtualChangeSet, isCompletelyResolved, err := s.consensusStateManager.ResolveVirtual(maxBlocksToResolve)
if err != nil {
return nil, false, err

View File

@ -9,7 +9,10 @@ import (
"sort"
)
func (csm *consensusStateManager) tipsInDecreasingGHOSTDAGParentOrder(stagingArea *model.StagingArea) ([]*externalapi.DomainHash, error) {
// tipsInDecreasingGHOSTDAGParentSelectionOrder returns the current DAG tips in decreasing parent selection order.
// This means that the first tip in the resulting list would be the GHOSTDAG selected parent, and if removed from the list,
// the second tip would be the selected parent, and so on.
func (csm *consensusStateManager) tipsInDecreasingGHOSTDAGParentSelectionOrder(stagingArea *model.StagingArea) ([]*externalapi.DomainHash, error) {
tips, err := csm.consensusStateStore.Tips(stagingArea, csm.databaseContext)
if err != nil {
return nil, err
@ -32,7 +35,7 @@ func (csm *consensusStateManager) tipsInDecreasingGHOSTDAGParentOrder(stagingAre
}
func (csm *consensusStateManager) findNextPendingTip(stagingArea *model.StagingArea) (*externalapi.DomainHash, externalapi.BlockStatus, error) {
orderedTips, err := csm.tipsInDecreasingGHOSTDAGParentOrder(stagingArea)
orderedTips, err := csm.tipsInDecreasingGHOSTDAGParentSelectionOrder(stagingArea)
if err != nil {
return nil, externalapi.StatusInvalid, err
}
@ -64,7 +67,7 @@ func (csm *consensusStateManager) findNextPendingTip(stagingArea *model.StagingA
return nil, externalapi.StatusInvalid, nil
}
// getGHOSTDAGLowerTips returns the set of tips which are lower in GHOSTDAG parent order than `pendingTip`. i.e.,
// getGHOSTDAGLowerTips returns the set of tips which are lower in GHOSTDAG parent selection order than `pendingTip`. i.e.,
// they can be added to virtual parents but `pendingTip` will remain the virtual selected parent
func (csm *consensusStateManager) getGHOSTDAGLowerTips(stagingArea *model.StagingArea, pendingTip *externalapi.DomainHash) ([]*externalapi.DomainHash, error) {
tips, err := csm.consensusStateStore.Tips(stagingArea, csm.databaseContext)

View File

@ -116,7 +116,7 @@ func (tc *testConsensus) ResolveVirtualWithMaxParam(maxBlocksToResolve uint64) (
tc.lock.Lock()
defer tc.lock.Unlock()
return tc.resolveVirtualNoLock(maxBlocksToResolve)
return tc.resolveVirtualChunkNoLock(maxBlocksToResolve)
}
// jsonBlock is a json representation of a block in mine format