-
Notifications
You must be signed in to change notification settings - Fork 37.7k
rpc: Use untranslated error strings in loadtxoutset #30395
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
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. 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. |
Concept ACK |
fa7f58e
to
fa55ada
Compare
fa55ada
to
fa79edb
Compare
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
fa79edb
to
fa22edc
Compare
utACK fa22edc |
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.
Approach ACK
@@ -2833,7 +2833,7 @@ static RPCHelpMan loadtxoutset() | |||
|
|||
auto activation_result{chainman.ActivateSnapshot(afile, metadata, false)}; | |||
if (!activation_result) { | |||
throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf(_("Unable to load UTXO snapshot: %s\n"), util::ErrorString(activation_result)).original); | |||
throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf("Unable to load UTXO snapshot: %s. (%s)", util::ErrorString(activation_result).original, path.utf8string())); |
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.
nit: It looks like there might be an extraneous period for at least some error messages (between the error message and the parenthesis-wrapped path).
Created a snapshot with dumptxoutset
.
Modified a byte in the snapshot to induce failure during load.
$ src/bitcoin-cli loadtxoutset mytxoutset.dat
error code: -32603
error message:
Unable to load UTXO snapshot: assumeutxo block hash in snapshot metadata not recognized (hash: 767fccc851802c0180a3ebf1631ab978d4d6a5ae1d452dc26e9c177850708e6c, height: 101). The following snapshot heights are available: 110, 299.. (/home/dev/.bitcoin/regtest/mytxoutset.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.
Thx, removed .
.
fa22edc
to
fa5b892
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.
ACK fa5b892
Re-ran check in #30395 (comment) . No extra period seen.
Ran unit/functional tests locally, including feature_assumeutxo
(all passed).
re-ACK fa5b892 |
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.
Code review ACK fa5b892
@@ -5732,7 +5732,7 @@ util::Result<void> ChainstateManager::ActivateSnapshot( | |||
static_cast<size_t>(current_coinstip_cache_size * SNAPSHOT_CACHE_PERC)); | |||
} | |||
|
|||
auto cleanup_bad_snapshot = [&](const char* reason) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) { | |||
auto cleanup_bad_snapshot = [&](bilingual_str&& reason) EXCLUSIVE_LOCKS_REQUIRED(::cs_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.
In commit "rpc: Use untranslated error strings in loadtxoutset" (fa5b892)
Not important, but you could change this from bilingual_str&&
to just bilingual_str
so it is simpler, and function can be called naturally with both lvalues and rvalues, not just rvalues. Rvalues will be moved in any case.
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.
Post-merge ACK fa5b892.
The message is not exposed in the GUI or another translated context, so translating it is useless for now. Also, fix a nit from bitcoin#30395 (comment)
The message is not exposed in the GUI or another translated context, so translating it is useless for now. Also, fix a nit from bitcoin#30395 (comment)
The message is not exposed in the GUI or another translated context, so translating it is useless for now. Also, fix a nit from bitcoin/bitcoin#30395 (comment)
Summary: > rpc: Fix race in loadtxoutset > > The tip may have advanced, also if it did not, there is no reason to > have two variables point to the same block. bitcoin/bitcoin@fa91089 The potential race just means that tip_hash in the RPC response could be different from "the hash of the base of the snapshot" (as documented in the RPC doc). Note that this race cannot really happen in the functional test, as there are no blocks coming over the network during the loadtxoutset call (blocks are mined locally). It could have happened in the wild, with very limited impact. The node would keep working fine, but some users may have been confused by the RPC response. > refactor: Move early loadtxoutset checks into ActiveSnapshot > > Also changes the return type of ActiveSnapshot to allow returning the > error message to the user of the loadtxoutset RPC. bitcoin/bitcoin@80315c0 > refactor: Use named arguments to get path arg in loadtxoutset > > rpc: Use untranslated error strings in loadtxoutset [[bitcoin/bitcoin#30395 | core#30395]] This is a partial backport of [[bitcoin/bitcoin#29262 | core#29262]], [[bitcoin/bitcoin#30267 | core#30267]] and [[bitcoin/bitcoin#30395 | core#30395]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D18055
Motivation:
Also, while touching this:
\n
. See assumeutxo: Check snapshot base block is not in invalid chain #30267 (comment)