Convert all log messages in pick_virtual_parents.go to Debugf (#1335)

This commit is contained in:
Svarog 2021-01-03 10:20:37 +02:00 committed by GitHub
parent 51625e7967
commit 8c8da3b01f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,24 +95,24 @@ func (csm *consensusStateManager) selectVirtualSelectedParent(
}
selectedParentCandidate := candidatesHeap.Pop()
log.Tracef("Checking block %s for selected parent eligibility", selectedParentCandidate)
log.Debugf("Checking block %s for selected parent eligibility", selectedParentCandidate)
selectedParentCandidateStatus, err := csm.blockStatusStore.Get(csm.databaseContext, selectedParentCandidate)
if err != nil {
return nil, err
}
if selectedParentCandidateStatus == externalapi.StatusUTXOValid {
log.Tracef("Block %s is valid. Returning it as the selected parent", selectedParentCandidate)
log.Debugf("Block %s is valid. Returning it as the selected parent", selectedParentCandidate)
return selectedParentCandidate, nil
}
log.Tracef("Block %s is not valid. Adding it to the disqualified set", selectedParentCandidate)
log.Debugf("Block %s is not valid. Adding it to the disqualified set", selectedParentCandidate)
disqualifiedCandidates.Add(selectedParentCandidate)
candidateParents, err := csm.dagTopologyManager.Parents(selectedParentCandidate)
if err != nil {
return nil, err
}
log.Tracef("The parents of block %s are: %s", selectedParentCandidate, candidateParents)
log.Debugf("The parents of block %s are: %s", selectedParentCandidate, candidateParents)
for _, parent := range candidateParents {
parentChildren, err := csm.dagTopologyManager.Children(parent)
if err != nil {
@ -126,10 +126,10 @@ func (csm *consensusStateManager) selectVirtualSelectedParent(
break
}
}
log.Tracef("The children of block %s are: %s", parent, parentChildren)
log.Debugf("The children of block %s are: %s", parent, parentChildren)
if disqualifiedCandidates.ContainsAllInSlice(parentChildren) {
log.Tracef("The disqualified set contains all the "+
log.Debugf("The disqualified set contains all the "+
"children of %s. Adding it to the candidate heap", parentChildren)
err := candidatesHeap.Push(parent)
if err != nil {
@ -156,7 +156,7 @@ func (csm *consensusStateManager) mergeSetIncrease(
for queue.Len() > 0 {
current := queue.Pop()
log.Tracef("Attempting to increment the merge set size increase for block %s", current)
log.Debugf("Attempting to increment the merge set size increase for block %s", current)
isInPastOfSelectedVirtualParents, err := csm.dagTopologyManager.IsAncestorOfAny(
current, selectedVirtualParents.ToSlice())
@ -164,7 +164,7 @@ func (csm *consensusStateManager) mergeSetIncrease(
return 0, err
}
if isInPastOfSelectedVirtualParents {
log.Tracef("Skipping block %s because it's in the past of one "+
log.Debugf("Skipping block %s because it's in the past of one "+
"(or more) of the selected virtual parents", current)
continue
}
@ -186,7 +186,7 @@ func (csm *consensusStateManager) mergeSetIncrease(
}
}
}
log.Tracef("The resolved merge set size increase is: %d", mergeSetIncrease)
log.Debugf("The resolved merge set size increase is: %d", mergeSetIncrease)
return mergeSetIncrease, nil
}
@ -197,7 +197,7 @@ func (csm *consensusStateManager) boundedMergeBreakingParents(
log.Tracef("boundedMergeBreakingParents start for parents: %s", parents)
defer log.Tracef("boundedMergeBreakingParents end for parents: %s", parents)
log.Tracef("Temporarily setting virtual to all parents, so that we can run ghostdag on it")
log.Debug("Temporarily setting virtual to all parents, so that we can run ghostdag on it")
err := csm.dagTopologyManager.SetParents(model.VirtualBlockHash, parents)
if err != nil {
return nil, err
@ -212,13 +212,13 @@ func (csm *consensusStateManager) boundedMergeBreakingParents(
if err != nil {
return nil, err
}
log.Tracef("The potentially kosherizing blocks are: %s", potentiallyKosherizingBlocks)
log.Debugf("The potentially kosherizing blocks are: %s", potentiallyKosherizingBlocks)
virtualFinalityPoint, err := csm.finalityManager.VirtualFinalityPoint()
if err != nil {
return nil, err
}
log.Tracef("The finality point of the virtual is: %s", virtualFinalityPoint)
log.Debugf("The finality point of the virtual is: %s", virtualFinalityPoint)
var badReds []*externalapi.DomainHash
@ -227,13 +227,13 @@ func (csm *consensusStateManager) boundedMergeBreakingParents(
return nil, err
}
for _, redBlock := range virtualGHOSTDAGData.MergeSetReds() {
log.Tracef("Check whether red block %s is kosherized", redBlock)
log.Debugf("Check whether red block %s is kosherized", redBlock)
isFinalityPointInPast, err := csm.dagTopologyManager.IsAncestorOf(virtualFinalityPoint, redBlock)
if err != nil {
return nil, err
}
if isFinalityPointInPast {
log.Tracef("Skipping red block %s because it has the virtual's"+
log.Debugf("Skipping red block %s because it has the virtual's"+
" finality point in its past", redBlock)
continue
}
@ -244,21 +244,21 @@ func (csm *consensusStateManager) boundedMergeBreakingParents(
if err != nil {
return nil, err
}
log.Tracef("Red block %s is an ancestor of potentially kosherizing "+
log.Debugf("Red block %s is an ancestor of potentially kosherizing "+
"block %s, therefore the red block is kosher", redBlock, potentiallyKosherizingBlock)
if isKosherized {
break
}
}
if !isKosherized {
log.Tracef("Red block %s is not kosher. Adding it to the bad reds set", redBlock)
log.Debugf("Red block %s is not kosher. Adding it to the bad reds set", redBlock)
badReds = append(badReds, redBlock)
}
}
boundedMergeBreakingParents := hashset.New()
for _, parent := range parents {
log.Tracef("Checking whether parent %s breaks the bounded merge set", parent)
log.Debugf("Checking whether parent %s breaks the bounded merge set", parent)
isBadRedInPast := false
for _, badRedBlock := range badReds {
isBadRedInPast, err = csm.dagTopologyManager.IsAncestorOf(parent, badRedBlock)
@ -266,12 +266,12 @@ func (csm *consensusStateManager) boundedMergeBreakingParents(
return nil, err
}
if isBadRedInPast {
log.Tracef("Parent %s is an ancestor of bad red %s", parent, badRedBlock)
log.Debugf("Parent %s is an ancestor of bad red %s", parent, badRedBlock)
break
}
}
if isBadRedInPast {
log.Tracef("Adding parent %s to the bounded merge breaking parents set", parent)
log.Debugf("Adding parent %s to the bounded merge breaking parents set", parent)
boundedMergeBreakingParents.Add(parent)
}
}