mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
Allow GetMissingBlockBodyHashes return an empty list if the missing blocks were requested before IBD start (#1498)
* Allow GetMissingBlockBodyHashes return an empty list if the missing blocks were requested before IBD start * Add link to issue in comment about error to be fixed
This commit is contained in:
parent
608d1f8ef9
commit
6bc7a4eb85
@ -468,6 +468,13 @@ func (flow *handleRelayInvsFlow) syncMissingBlockBodies(highHash *externalapi.Do
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(hashes) == 0 {
|
||||
// Blocks can be inserted inside the DAG during IBD if those were requested before IBD started.
|
||||
// In rare cases, all the IBD blocks might be already inserted by the time we reach this point.
|
||||
// In these cases - GetMissingBlockBodyHashes would return an empty array.
|
||||
log.Debugf("No missing block body hashes found.")
|
||||
return nil
|
||||
}
|
||||
|
||||
for offset := 0; offset < len(hashes); offset += ibdBatchSize {
|
||||
var hashesToRequest []*externalapi.DomainHash
|
||||
|
@ -86,7 +86,7 @@ func (csm *consensusStateManager) importPruningPoint(newPruningPoint *externalap
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debugf("Staging the new pruning point")
|
||||
log.Debugf("Staging the new pruning point %s", newPruningPointHash)
|
||||
csm.pruningStore.StagePruningPoint(newPruningPointHash)
|
||||
|
||||
log.Debugf("Populating the pruning point with UTXO entries")
|
||||
|
@ -126,8 +126,14 @@ func (sm *syncManager) missingBlockBodyHashes(highHash *externalapi.DomainHash)
|
||||
lowHash = selectedChild
|
||||
}
|
||||
if !foundHeaderOnlyBlock {
|
||||
// TODO: Once block children are fixed, this error
|
||||
// should be returned instead of simply logged
|
||||
if lowHash == highHash {
|
||||
// Blocks can be inserted inside the DAG during IBD if those were requested before IBD started.
|
||||
// In rare cases, all the IBD blocks might be already inserted by the time we reach this point.
|
||||
// In these cases - return an empty list of blocks to sync
|
||||
return []*externalapi.DomainHash{}, nil
|
||||
}
|
||||
// TODO: Once block children are fixed (https://github.com/kaspanet/kaspad/issues/1499),
|
||||
// this error should be returned rather the logged
|
||||
log.Errorf("no header-only blocks between %s and %s",
|
||||
lowHash, highHash)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user