Fixes #19361 by moving resetting the g_scan_progress variable before inferring the descriptors
rpc/blockchain: Reset scantxoutset progress before inferring descriptors #19362
pull prusnak wants to merge 1 commits into bitcoin:master from prusnak:rpc-scantxoutset-reset-progress changing 1 files +2 −1-
prusnak commented at 11:56 AM on June 23, 2020: contributor
- fanquake added the label RPC/REST/ZMQ on Jun 23, 2020
-
promag commented at 10:18 PM on June 25, 2020: member
Code review ACK 71fee9cd12898c74b46659a3e16c90df051af632.
There's still a slight chance of getting non zero progress. See b6b1945005a8205af6781adb8cc258f629417f25 for an alternative.
IMO could be backport.
-
prusnak commented at 8:51 AM on June 27, 2020: contributor
At first sight, it seems that your patch b6b1945005a8205af6781adb8cc258f629417f25 makes more sense.
- luke-jr approved
-
luke-jr commented at 10:52 PM on July 23, 2020: member
Still a race, but I don't see an easy fix and this is probably good enough
utACK
-
rpc: reset scantxoutset progress on finish 8c4129b454
- prusnak force-pushed on Jul 24, 2020
-
promag commented at 9:23 AM on July 24, 2020: member
ACK
-
in src/rpc/blockchain.cpp:2024 in 8c4129b454
2020 | @@ -2021,13 +2021,15 @@ class CoinsViewScanReserver 2021 | if (g_scan_in_progress.exchange(true)) { 2022 | return false; 2023 | } 2024 | + CHECK_NONFATAL(g_scan_progress == 0);
luke-jr commented at 7:21 AM on August 1, 2020:If this were to fail, wouldn't it likely block all future reserves?
promag commented at 9:11 AM on August 1, 2020:You mean this should be fatal?
luke-jr commented at 3:37 PM on August 1, 2020:Since it should be impossible, maybe simplest solution is to just remove it.
Otherwise, it might need something like:
if (g_scan_progress) { error("ERROR: g_scan_progress was %s when it should be 0, in %s", g_scan_progress, __func__); g_scan_progress = 0; }Or:
if (g_scan_progress) { g_scan_in_progress = false; CHECK_NONFATAL(g_scan_progress == 0); }
MarcoFalke commented at 9:18 AM on June 25, 2021:You can restart your node if this fails, but I don't think there is a need to crash the node.
luke-jr referenced this in commit ebcb7a2aaf on Aug 15, 2020promag commented at 11:03 PM on November 23, 2020: memberShould we just drop the
CHECK_NONFATAL(g_scan_progress == 0);line? @prusnak I tend to like these invariants, it makes easier to understand the code. I think @luke-jr concern could be addressed by:const int scan_progress = g_scan_progress.exchange(0); CHECK_NONFATAL(scan_progress == 0);I think @jonasschnelli, @MarcoFalke, @laanwj should take a look too for 0.21.
jonatack commented at 10:17 AM on November 24, 2020: memberConcept ACK. In the absence of test coverage, I agree this should check and fail somewhat loudly if
g_scan_progressisn't 0 here.MarcoFalke added the label Needs backport (0.21) on Nov 25, 2020MarcoFalke added this to the milestone 0.21.0 on Nov 25, 2020achow101 commented at 4:36 PM on December 9, 2020: memberCode review ACK 8c4129b4540f4f739413ed9a6fbfc78afc252f42
MarcoFalke removed this from the milestone 0.21.0 on Dec 15, 2020MarcoFalke added this to the milestone 0.21.1 on Dec 15, 2020laanwj removed this from the milestone 0.21.1 on Apr 16, 2021laanwj added this to the milestone 0.21.2 on Apr 16, 2021laanwj commented at 5:18 AM on April 16, 2021: memberSorry for bumping the milestone here again. It seems almost ready for merge (could use one more ACK) but we don't want to rush a backport into 0.21.1.
laanwj removed this from the milestone 0.21.2 on Jun 24, 2021laanwj added this to the milestone 22.0 on Jun 24, 2021laanwj commented at 7:31 PM on June 24, 2021: memberThis came up in the IRC meeting. Adding this to the 22.0 milestone so it can hopefully be included there.
MarcoFalke merged this on Jun 25, 2021MarcoFalke closed this on Jun 25, 2021prusnak deleted the branch on Jun 25, 2021fanquake locked this on Jun 25, 2021fanquake deleted a comment on Jun 25, 2021fanquake removed the label Needs backport (0.21) on Jul 29, 2021
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:14 UTC
More mirrored repositories can be found on mirror.b10c.me