Skip to content

Conversation

theStack
Copy link
Contributor

@theStack theStack commented Aug 7, 2024

This PR is a small follow-up for #28052, adding support for the block linearization script to handle XORed blocksdir *.dat files. Note that if no xor.dat file exists, the XOR pattern is set to all-zeros, in order to still support blockdirs that have been created with versions earlier than 28.x.

Partly fixes issue #30599.

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 7, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK tdb3, hodlinator, achow101

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@theStack theStack force-pushed the 202408-contrib-block_xor_support_for_linearize-data branch from fb5c964 to 77ff0ec Compare August 7, 2024 21:53
@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 7, 2024

🚧 At least one of the CI tasks failed.
Debug: https://github.com/bitcoin/bitcoin/runs/28486114479

Hints

Make sure to run all tests locally, according to the documentation.

The failure may happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

Copy link
Contributor

@tdb3 tdb3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 77ff0ec
Nice work. Simplifies the test and enhances chain archive capability.

In addition to running unit/functionals locally (passed) and light code review, performed some sanity checks:

  1. Created a regtest chain (~11k transactions in 411 blocks)
  2. Confirmed that xor.dat had a non-zero key, created hashlist, then stopped bitcoind
  3. Created a bootstrap.dat with linearize-data.py (successful)
  4. Deleted the regtest datadir
  5. Started bitcoind with -loadblock=/path/to/bootstrap.dat -blocksxor=0 (successful restore), then stopped bitcoind
  6. Deleted xor.dat from the regtest/blocks/
  7. Created another bootstrap.dat with linearize-data.py (successful)
  8. Started bitcoind with -loadblock=/path/to/bootstrap.dat (successful restore), then stopped bitcoind

Copy link
Contributor

@hodlinator hodlinator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 77ff0ec

Good to see follow-up work for #28052 being carried out.

1cbc5ae explains purpose of linearize-scripts (as it was not immediately apparent to me). Could be cherry-picked into this PR, or left for a further follow-up.

  1. bitcoind -regtest &
  2. bitcoin-cli -regtest getblockcount returns height=120.
  3. contrib/linearize/linearize-hashes.py contrib/linearize/example-linearize.cfg > hashlist.txt (with modified .cfg).
  4. pkill bitcoind
  5. contrib/linearize/linearize-data.py contrib/linearize/example-linearize.cfg
  6. mv ~/.bitcoin/regtest/ ~/regtest_old
  7. bitcoind -regtest &
  8. bitcoin-cli -regtest getblockcount returns height=0.
  9. pkill bitcoind
  10. bitcoind -regtest -loadblock=/home/hodlinator/bootstrap.dat
  11. bitcoin-cli -regtest getblockcount returns the original height=120.

Edit: Also passed unit & functional tests locally.

@achow101 achow101 added this to the 28.0 milestone Aug 12, 2024
@achow101
Copy link
Member

ACK 77ff0ec

@achow101 achow101 merged commit ba5fdd1 into bitcoin:master Aug 12, 2024
16 checks passed
@theStack theStack deleted the 202408-contrib-block_xor_support_for_linearize-data branch August 12, 2024 20:21
hodlinator added a commit to hodlinator/bitcoin that referenced this pull request Oct 7, 2024
Add information to speed up grokking of purpose of scripts.

Prompted by reviewing bitcoin#30607.
hodlinator added a commit to hodlinator/bitcoin that referenced this pull request Oct 7, 2024
Add information to speed up grokking of purpose of scripts.

Prompted by reviewing bitcoin#30607.
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 25, 2024
…ze-data.py script

77ff0ec contrib: support reading XORed blocks in linearize-data.py script (Sebastian Falbesoner)

Pull request description:

  This PR is a small follow-up for bitcoin#28052, adding support for the block linearization script to handle XORed blocksdir *.dat files. Note that if no xor.dat file exists, the XOR pattern is set to all-zeros, in order to still support blockdirs that have been created with versions earlier than 28.x.

  Partly fixes issue bitcoin#30599.

ACKs for top commit:
  achow101:
    ACK 77ff0ec
  tdb3:
    ACK 77ff0ec
  hodlinator:
    ACK 77ff0ec

Tree-SHA512: 011eb02e2411de373cbbf4b26db4640fc693a20be8c2430529fba6e36a3a3abfdfdc3b005d330f9ec2846bfad9bfbf34231c574ba99289ef37dd51a68e6e7f3d
@bitcoin bitcoin locked and limited conversation to collaborators Aug 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants