Compare commits

...

8 Commits

Author SHA1 Message Date
msutton
685c049a12 yet another checkpoint 2022-03-07 15:51:59 +02:00
msutton
9b45e803d0 Merge branch 'dev' into patch 2022-03-07 14:54:57 +02:00
msutton
cb5e9b55b7 Update checkpoint to yet another side-chain 2022-03-07 14:54:05 +02:00
Ori Newman
190e725dd0 Optimize expected header pruning point (#1962)
* Use the correct heuristic to avoid checking for next pruning point movement when not needed
2022-03-07 00:16:29 +02:00
msutton
20f16cf729 Update checkpoint to new side-chain 2022-03-06 01:03:44 +02:00
Ori Newman
4d3f504b73 Check checkpoint only if highestSharedBlockFound 2022-03-02 21:17:46 +02:00
Ori Newman
b5eda33488 remove count 2022-03-02 13:11:32 +02:00
Ori Newman
ef1a3c0dce remove debug log 2022-03-02 13:09:34 +02:00
2 changed files with 25 additions and 34 deletions

View File

@@ -85,25 +85,27 @@ func (flow *handleIBDFlow) runIBDIfNotRunning(block *externalapi.DomainBlock) er
return err
}
log.Criticalf("Found highest shared chain block %s with peer %s", highestSharedBlockHash, flow.peer)
checkpoint, err := externalapi.NewDomainHashFromString("05ff0f2e1d201dcaee7c5e567cc2c1d42ca3cce9fefbd3b519dc68b5bb89d0b9")
if err != nil {
return err
}
info, err := flow.Domain().Consensus().GetBlockInfo(checkpoint)
if err != nil {
return err
}
if info.Exists {
isInSelectedParentChainOf, err := flow.Domain().Consensus().IsInSelectedParentChainOf(checkpoint, highestSharedBlockHash)
if highestSharedBlockFound {
checkpoint, err := externalapi.NewDomainHashFromString("f4a415f28990806a899a208b77930fa5a58f3a94876c3cbe814e60a7ed22824f")
if err != nil {
return err
}
if !isInSelectedParentChainOf {
log.Criticalf("Stopped IBD because the checkpoint %s is not in the selected chain of %s", checkpoint, highestSharedBlockHash)
return nil
info, err := flow.Domain().Consensus().GetBlockInfo(checkpoint)
if err != nil {
return err
}
if info.Exists {
isInSelectedParentChainOf, err := flow.Domain().Consensus().IsInSelectedParentChainOf(checkpoint, highestSharedBlockHash)
if err != nil {
return err
}
if !isInSelectedParentChainOf {
log.Criticalf("Stopped IBD because the checkpoint %s is not in the selected chain of %s", checkpoint, highestSharedBlockHash)
return nil
}
}
}
@@ -329,7 +331,6 @@ func (flow *handleIBDFlow) syncPruningPointFutureHeaders(consensus externalapi.C
}
})
count := 0
for {
select {
case ibdBlocksMessage, ok := <-blockHeadersMessageChan:
@@ -346,26 +347,10 @@ func (flow *handleIBDFlow) syncPruningPointFutureHeaders(consensus externalapi.C
return nil
}
for _, header := range ibdBlocksMessage.BlockHeaders {
added, err := flow.processHeader(consensus, header)
_, err := flow.processHeader(consensus, header)
if err != nil {
return err
}
if added {
count++
log.Criticalf("LALA %d Accepted header %s DAA score %d blue score %d Arrived at %d ( %s ) timestamp %d ( %s ) diff %d ( %s )",
count,
header.BlockHash(),
header.DAAScore,
header.BlueScore,
time.Now().UnixMilli(),
time.Now(),
header.Timestamp.UnixMilliseconds(),
header.Timestamp,
time.Now().UnixMilli()-header.Timestamp.UnixMilliseconds(),
time.Millisecond*time.Duration(time.Now().UnixMilli()-header.Timestamp.UnixMilliseconds()),
)
}
}
lastReceivedHeader := ibdBlocksMessage.BlockHeaders[len(ibdBlocksMessage.BlockHeaders)-1]

View File

@@ -995,7 +995,13 @@ func (pm *pruningManager) ExpectedHeaderPruningPoint(stagingArea *model.StagingA
return nil, err
}
if hasPruningPointInItsSelectedChain && pm.finalityScore(ghostdagData.BlueScore()) > pm.finalityScore(selectedParentPruningPointHeader.BlueScore()+pm.pruningDepth) {
// Note: the pruning point from the POV of the current block is the first block in its chain that is in depth of pm.pruningDepth and
// its finality score is greater than the previous pruning point. This is why the diff between finalityScore(selectedParent.blueScore + 1) * finalityInterval
// and the current block blue score is less than pm.pruningDepth we can know for sure that this block didn't trigger a pruning point change.
minRequiredBlueScoreForNextPruningPoint := (pm.finalityScore(selectedParentPruningPointHeader.BlueScore()) + 1) * pm.finalityInterval
if hasPruningPointInItsSelectedChain &&
minRequiredBlueScoreForNextPruningPoint+pm.pruningDepth <= ghostdagData.BlueScore() {
var suggestedLowHash *externalapi.DomainHash
hasReachabilityData, err := pm.reachabilityDataStore.HasReachabilityData(pm.databaseContext, stagingArea, selectedParentHeader.PruningPoint())
if err != nil {