Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix handling of invalid compact blocks #9026
BIP 152 allows compact blocks to be relayed prior to full validation, requiring that:
This patch fixes the handling of compact blocks so that after compact block reconstruction, we will not ban a peer if it turns out the block is invalid.
Reworked to try to avoid the problems pointed out by @kazcw.
I don't really like this approach; I was planning to wait for the refactors being done by @TheBlueMatt elsewhere to settle down to try to fix this more cleanly, but he pointed out that we'd want to backport this bugfix to 0.13 so I went ahead and redid this in a way that is close to how the backport would look.
Due to the code moves that have already happened in master (I think #8865) this didn't cherry-pick cleanly on 0.13, so I'll separately PR the backport for review.
referenced this pull request
Oct 31, 2016
I discussed this with @TheBlueMatt, who pointed out that
Also @gmaxwell suggested on IRC (if I understood correctly!) that we bump the protocol version so that we could distinguish between peers that have the old (buggy) banning behavior and peers that have this new behavior, so I did that here as well.
This all needs a BIP update, so I'll draft one, and I'll also mirror these changes in #9048.
TheBlueMatt left a comment
Generally looks good, would like a test to check disconnect/ban on bad PoW, but not strictly required (didnt change that code here anyway).
I assume the test failure is spurious, if thats the case, general utACK on this.
Note that the follow on to #8969 will remove both the pfrom and the new bool parameter from ProcessNewBlock, so I'd really prefer not to create some wrapper to hide net-related crap when it's moving to the callsite soon (or we can discuss then).
On November 3, 2016 3:14:46 AM EDT, Pieter Wuille email@example.com wrote: