-
Notifications
You must be signed in to change notification settings - Fork 36.9k
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
init: Remove auto-import of bootstrap.dat
and associated code
#17044
Conversation
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.
The CIs don't like the new test yet, probably because the relative paths require one to be in the bitcoin root dir for the scripts to be found.
Also, the help text for loadblock
, "Imports blocks from external blk000??.dat file on startup" could be updated to remove the file name.
bootstrap.dat
and associated code
05fdea9
to
351cc69
Compare
Concept ACK |
f9487eb
to
2ac1637
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
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.
Concept ACK
Concept ACK |
89339d1 tests: Add test for loadblock option (Fabian Jahr) Pull request description: Fixes #17019 Was initially part of #17044 but as the test got larger it made sense to split it into its own commit as suggested in #17019 . This is testing the `-loadblock` option by using the scripts in `contrib/linearize` to generate a `bootstrap.dat` file and starting a disconnected node with it. So it is also testing the linearize scripts which were untested before and needed to be made available for the CI environment, hence they are added to `DIST_CONTRIB` in `Makefile.am`. ACKs for top commit: laanwj: ACK 89339d1 Tree-SHA512: aede0cd6e8b21194973f3633bc07fa2672d66a6f85dfe6a57cee2bb269a65d19ea49d5f9ed7914a173b3847c76e70257aa865f44bde170c1999d9655b4862d1c
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.
some questions
@@ -374,7 +374,7 @@ void SetupServerArgs() | |||
gArgs.AddArg("-debuglogfile=<file>", strprintf("Specify location of debug log file. Relative paths will be prefixed by a net-specific datadir location. (-nodebuglogfile to disable; default: %s)", DEFAULT_DEBUGLOGFILE), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); | |||
gArgs.AddArg("-feefilter", strprintf("Tell other nodes to filter invs to us by our mempool min fee (default: %u)", DEFAULT_FEEFILTER), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS); | |||
gArgs.AddArg("-includeconf=<file>", "Specify additional configuration file, relative to the -datadir path (only useable from configuration file, not command line)", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); | |||
gArgs.AddArg("-loadblock=<file>", "Imports blocks from external blk000??.dat file on startup", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); | |||
gArgs.AddArg("-loadblock=<file>", "Imports blocks from external file on startup", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); |
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.
why is this removed? I'd rather add a test for importing blk000.dat
files.
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.
@MarcoFalke: I suggested removing that above, because it seemed to imply a non-existing naming convention for the file (might as well load from bootstrap.dat
or whatever your file is named).
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.
See for example this test:
diff --git a/test/functional/feature_loadblock.py b/test/functional/feature_loadblock.py
index bf2a4ff61f..a532a83946 100755
--- a/test/functional/feature_loadblock.py
+++ b/test/functional/feature_loadblock.py
@@ -25,7 +25,7 @@ from test_framework.util import assert_equal, wait_until
class LoadblockTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
- self.num_nodes = 2
+ self.num_nodes = 3
def run_test(self):
self.nodes[1].setnetworkactive(state=False)
@@ -71,13 +71,16 @@ class LoadblockTest(BitcoinTestFramework):
subprocess.run([sys.executable, linearize_data_file, cfg_file],
check=True)
- self.log.info("Restart second, unsynced node with bootstrap file")
+ self.log.info("Restart unsynced nodes with bootstrap file or raw block file")
self.stop_node(1)
self.start_node(1, ["-loadblock=" + bootstrap_file])
- wait_until(lambda: self.nodes[1].getblockcount() == 100)
+ self.stop_node(2)
+ self.start_node(2, ["-loadblock=" + os.path.join(blocks_dir, 'blk00000.dat')])
+ for i in [1, 2]:
+ wait_until(lambda: self.nodes[i].getblockcount() == 100)
- assert_equal(self.nodes[1].getblockchaininfo()['blocks'], 100)
- assert_equal(self.nodes[0].getbestblockhash(), self.nodes[1].getbestblockhash())
+ assert_equal(self.nodes[i].getblockchaininfo()['blocks'], 100)
+ assert_equal(self.nodes[0].getbestblockhash(), self.nodes[i].getbestblockhash())
if __name__ == '__main__':
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.
Agree with removing this. blkXXXXX.dat
are the block files and the way to (re)index them is -reindex
, it has nothing to do with -loadblock
.
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.
Isn't the point that you can import the block.dat files from another datadir with -loadblock=blk001.dat -loadblock=blk002.dat -loadblock=...
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.
I don't think that's the point. In that case it's less hassle to copy over all the blk files and do a reindex
.
I think the idea behind -loadblock
is to import the output from linearize; huge consecutive 'block archives' (there used to be torrents for this). But I might be wrong. I'm not sure what it's used for nowadays.
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.
Oh, so it is multi-arg to support a split-up bootstrap.dat?
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.
Yeah, that was my understanding as well. But I did see it spelled out anywhere explicitly.
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.
Oh, so it is multi-arg to support a split-up bootstrap.dat?
I think so; linearize splits it into 1GB files by default.
…ze scripts 89339d1 tests: Add test for loadblock option (Fabian Jahr) Pull request description: Fixes bitcoin#17019 Was initially part of bitcoin#17044 but as the test got larger it made sense to split it into its own commit as suggested in bitcoin#17019 . This is testing the `-loadblock` option by using the scripts in `contrib/linearize` to generate a `bootstrap.dat` file and starting a disconnected node with it. So it is also testing the linearize scripts which were untested before and needed to be made available for the CI environment, hence they are added to `DIST_CONTRIB` in `Makefile.am`. ACKs for top commit: laanwj: ACK 89339d1 Tree-SHA512: aede0cd6e8b21194973f3633bc07fa2672d66a6f85dfe6a57cee2bb269a65d19ea49d5f9ed7914a173b3847c76e70257aa865f44bde170c1999d9655b4862d1c
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 5453e2d
nit: diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index 1a7ce91ca67d47903a3b97d45944fb2df6ea2fa1..08004778e3e13284bf1de95efd24a62202847bfc 100644
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -384,7 +384,7 @@ Threads
- ThreadScriptCheck : Verifies block scripts.
-- ThreadImport : Loads blocks from blk*.dat files or bootstrap.dat.
+- ThreadImport : Loads blocks from `blk*.dat` files or `-loadblock=<file>`.
- StartNode : Starts other threads.
|
- only load blockfiles when we have paths - add release notes for modified bootstrap functionality - amend documentation on ThreadImport
@laanwj good catch, added that. |
ok, fine LGTM |
ACK 104f7de |
…ted code 104f7de remove old bootstrap relevant code (tryphe) Pull request description: This picks up #15954 I fixed the code and added at a functional test utilizing the scripts in `contrib/linearize` as suggested by @MarcoFalke . ACKs for top commit: laanwj: ACK 104f7de Tree-SHA512: acac9f285f9785fcbc3afc78118461e45bec2962f90ab90e9f82f3ad28adc90a44f0443b712458ccf486e46d891eb8a67f53e7bee5fa6d89e4387814fe03f117
Summary: > - only load blockfiles when we have paths > - add release notes for modified bootstrap functionality > - amend documentation on ThreadImport This is a backport of Core [[bitcoin/bitcoin#17044 | PR17044]] Note that the test related to this PR is already backported (D6512) Test Plan: `ninja && ./test/functional/test_runner.py feature_loadblock` Reviewers: O1 Bitcoin ABC, #bitcoin_abc, majcosta Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D8253
This picks up #15954
I fixed the code and added at a functional test utilizing the scripts in
contrib/linearize
as suggested by @MarcoFalke .