New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When rewinding, remove insufficiently-validated blocks #3132
Conversation
Related to #3100, which is tangentially similar. |
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.
utACK. Do we have a regression test for the bug?
That's what I was blocking on - trying to figure out a nice way to test it. I think I'll have to do the not-so-nice thing where we emulate the "switching clients" behaviour by stopping and starting nodes in an RPC test. |
I have (what I believe is) an RPC test for |
091f5a0
to
e09ad78
Compare
This PR now has an RPC test that fails before the fix, and passes afterwards. |
e09ad78
to
fcf908f
Compare
Force-pushed to fix PyFlakes warning 😄 |
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.
ACK. I also tested against Federer test datadir, where a Sprout 1.0.15 node rewinds and gets stuck at block 199999, but this PR enables the node to sync successfully with testnet.
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.
ut(ACK+cov) apart from the incorrect debugging messages.
qa/rpc-tests/rewind_index.py
Outdated
assert_equal(self.nodes[2].getbestblockhash(), block10o) | ||
|
||
# Restart node 0 using Sprout instead of Overwinter | ||
print("Switching node 0 from Sprout to Overwinter") |
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.
from Overwinter to Sprout
qa/rpc-tests/rewind_index.py
Outdated
assert_equal(self.nodes[0].getbestblockhash(), block10s) | ||
|
||
# Restart node 0 using Overwinter instead of Sprout | ||
print("Switching node 0 from Overwinter to Sprout") |
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.
from Sprout to Overwinter
If a block is insufficiently-validated against a particular branch ID, then we cannot guarantee that even the block header will be valid under the actual consensus rules the node will want to apply. Instead require that the blocks are completely re-validated, by removing them from the block index (which is equivalent to reducing their validity to BLOCK_VALID_UNKNOWN).
fcf908f
to
f5007d8
Compare
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.
re-ut(ACK+cov)
@zkbot r+ |
📌 Commit f5007d8 has been approved by |
When rewinding, remove insufficiently-validated blocks If a block is insufficiently-validated against a particular branch ID, then we cannot guarantee that even the block header will be valid under the actual consensus rules the node will want to apply. Instead require that the blocks are completely re-validated, by removing them from the block index (which is equivalent to reducing their validity to BLOCK_VALID_UNKNOWN). Closes #3100.
If a block is insufficiently-validated against a particular branch ID, then we
cannot guarantee that even the block header will be valid under the actual
consensus rules the node will want to apply. Instead require that the blocks are
completely re-validated, by removing them from the block index (which is
equivalent to reducing their validity to BLOCK_VALID_UNKNOWN).
Closes #3100.