Permalink
Browse files

Merge #7919: Fix headers announcements edge case

3a99fb2 Fix headers announcements edge case (Suhas Daftuar)
  • Loading branch information...
laanwj committed Apr 22, 2016
2 parents 0c95ebc + 3a99fb2 commit 76176823ba6a8e26fad62c413fbc5dbd9b14c3fb
Showing with 15 additions and 1 deletion.
  1. +15 −1 src/main.cpp
View
@@ -5717,7 +5717,21 @@ bool SendMessages(CNode* pto)
fRevertToInv = true;
break;
}
assert(pBestIndex == NULL || pindex->pprev == pBestIndex);
if (pBestIndex != NULL && pindex->pprev != pBestIndex) {
// This means that the list of blocks to announce don't
// connect to each other.
// This shouldn't really be possible to hit during
// regular operation (because reorgs should take us to
// a chain that has some block not on the prior chain,
// which should be caught by the prior check), but one
// way this could happen is by using invalidateblock /
// reconsiderblock repeatedly on the tip, causing it to
// be added multiple times to vBlockHashesToAnnounce.
// Robustly deal with this rare situation by reverting
// to an inv.
fRevertToInv = true;
break;
}
pBestIndex = pindex;
if (fFoundStartingHeader) {
// add this to the headers message

0 comments on commit 7617682

Please sign in to comment.