-
Notifications
You must be signed in to change notification settings - Fork 35.7k
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
Rework validation logic for assumeutxo #27746
Rework validation logic for assumeutxo #27746
Commits on Jul 14, 2023
-
Explicitly track maximum block height stored in undo files
When writing a new block to disk, if we have filled up the current block file, then we flush and truncate that block file (to free allocated but unused space) before advancing to the next one. When this happens, we have to determine whether to also flush and truncate the corresponding undo file. Undo data is only written when blocks are connected, not when blocks are received. Thus it's possible that the corresponding undo file already has all the data it will ever have, and we should flush/truncate it as we advance files; or it's possible that there is more data we expect to write, and should therefore defer flush/truncation until undo data is later written. Prior to this commit, we made the determination of whether the undo file was full of all requisite data by comparing against the chain tip. This patch replaces that dependence on validation data structures by instead just tracking the highest height of any block written in the undo file as we go.
Configuration menu - View commit details
-
Copy full SHA for fe86a7c - Browse repository at this point
Copy the full SHA fe86a7cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1cfc887 - Browse repository at this point
Copy the full SHA 1cfc887View commit details -
Move block-arrival information / preciousblock counters to Chainstate…
…Manager Block arrival information (and the preciousblock RPC, a related concept) are both chainstate-agnostic, so these are moved to ChainstateManager. This should just be a refactor, without any observable behavior changes.
Configuration menu - View commit details
-
Copy full SHA for 471da5f - Browse repository at this point
Copy the full SHA 471da5fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 10c0571 - Browse repository at this point
Copy the full SHA 10c0571View commit details -
Configuration menu - View commit details
-
Copy full SHA for 272fbc3 - Browse repository at this point
Copy the full SHA 272fbc3View commit details -
test: Clear block index flags when testing snapshots
When simulating a snapshot, remove the HAVE_DATA status for blocks below the snapshot height, to simulate never having downloaded them at all. This makes tests more realistic (and more closely match what will happen when using assumeutxo).
Configuration menu - View commit details
-
Copy full SHA for 3cfc753 - Browse repository at this point
Copy the full SHA 3cfc753View commit details
Commits on Jul 21, 2023
-
Move block-storage-related logic to ChainstateManager
Separate the notion of which blocks are stored on disk, and what data is in our block index, from what tip a chainstate might be able to get to. We can use chainstate-agnostic data to determine when to store a block on disk (primarily, an anti-DoS set of criteria) and let the chainstates figure out for themselves when a block is of interest for being a candidate tip. Note: some of the invariants in CheckBlockIndex are modified, but more work is needed (ie to move CheckBlockIndex to ChainstateManager, as most of what CheckBlockIndex is doing is checking the consistency of the block index, which is outside of Chainstate).
Configuration menu - View commit details
-
Copy full SHA for d0d40ea - Browse repository at this point
Copy the full SHA d0d40eaView commit details
Commits on Jul 24, 2023
-
Tighten requirements for adding elements to setBlockIndexCandidates
When using assumeutxo, we only need the background chainstate to consider blocks that are on the chain leading to the snapshotted block. Note that this introduces the new invariant that we can only have an assumeutxo snapshot where the snapshotted blockhash is in our block index. Unknown block hashes that are somehow passed in will cause assertion failures when processing new blocks. Includes test fixes and improvements by Andrew Chow and Fabian Jahr.
Configuration menu - View commit details
-
Copy full SHA for d43a1f1 - Browse repository at this point
Copy the full SHA d43a1f1View commit details -
Fix initialization of setBlockIndexCandidates when working with multi…
…ple chainstates When using assumeutxo and multiple chainstates are active, the background chainstate should consider all HAVE_DATA blocks that are ancestors of the snapshotted block and that have more work than the tip as potential candidates.
Configuration menu - View commit details
-
Copy full SHA for 768690b - Browse repository at this point
Copy the full SHA 768690bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0ce805b - Browse repository at this point
Copy the full SHA 0ce805bView commit details -
Move CheckBlockIndex() from Chainstate to ChainstateManager
Also rewrite CheckBlockIndex() to perform tests on all chainstates. This increases sanity-check coverage, as any place in our code where we were invoke CheckBlockIndex() on a single chainstate will now invoke the sanity checks on all chainstates. This change also tightens up the checks on setBlockIndexCandidates and mapBlocksUnlinked, to more precisely match what we aim for even in the presence of assumed-valid blocks.
Configuration menu - View commit details
-
Copy full SHA for 3556b85 - Browse repository at this point
Copy the full SHA 3556b85View commit details -
Cache block index entry corresponding to assumeutxo snapshot base blo…
…ckhash This is to (a) avoid repeated lookups into the block index for an entry that should never change and (b) emphasize that the snapshot base should always exist when set and not change during the runtime of the program. Thanks to Russ Yanofsky for suggesting this approach.
Configuration menu - View commit details
-
Copy full SHA for d4a11ab - Browse repository at this point
Copy the full SHA d4a11abView commit details -
Configuration menu - View commit details
-
Copy full SHA for a733dd7 - Browse repository at this point
Copy the full SHA a733dd7View commit details