diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-04-22 08:40:13 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-04-22 08:40:22 +0200 |
commit | 76176823ba6a8e26fad62c413fbc5dbd9b14c3fb (patch) | |
tree | 24aa98fbdf10a3b5f31e2dd262ba4528620749e2 | |
parent | 0c95ebce7e67f86f62c099974dde68c8d808240b (diff) | |
parent | 3a99fb2cb14955f5e029d315041a093e957e6c3e (diff) |
Merge #7919: Fix headers announcements edge case
3a99fb2 Fix headers announcements edge case (Suhas Daftuar)
-rw-r--r-- | src/main.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 1015e538d5..f6a89fa2e6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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 |