-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
POA network syncs old blocks successfully. Sync on mainnet however is stuck at #1914466
. Though no longer retracting and getting those bad blocks! Investigating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the code is shared with regular block import, would be good to triple check that resetting also works correctly for regular sync.
Overall the change seems reasonable.
let mut imported = HashSet::new(); | ||
let blocks = self.blocks.drain(); | ||
let count = blocks.len(); | ||
|
||
for block_and_receipts in blocks { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth to turn this loop into a closure and return an enum Importer { Reset, Bad, Imported(HashSet) }
instead of setting the flags.
That said, refactoring can be left to a separate PR.
if bad { | ||
return Err(BlockDownloaderImportError::Invalid); | ||
} | ||
|
||
if self.blocks.is_empty() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that correct? Seems that if we fail on the last block we are not going to return an error?
@tomusdrw I didn't notice any changes on regular sync, seemed to be working fine. But it seems like this PR doesn't fix the original issue completely (#9300 (comment)). So I'm going to investigate this a bit more and I'll put this |
What's the status? |
Fixes #9300 and fixes #7008. Merge after #9381.