Merge bitcoin/bitcoin#19362: rpc/blockchain: Reset scantxoutset progress before inferring descriptors

8c4129b454 rpc: reset scantxoutset progress on finish (Pavol Rusnak)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/19361 by moving resetting the `g_scan_progress` variable **before** inferring the descriptors

ACKs for top commit:
  achow101:
    Code review ACK 8c4129b454

Tree-SHA512: 2b81e5c930b9c201a1b9cc742c37e0617582326acd9adbd6b14991d33c05d51b1d5ff6a26f3accab7d274dc8c6a48bc8cbccf0811b60c1f76dd805f9b31482c0
This commit is contained in:
MarcoFalke 2021-06-25 11:21:29 +02:00
commit 3e306ee1d5
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -2258,6 +2258,7 @@ public:
if (g_scan_in_progress.exchange(true)) {
return false;
}
CHECK_NONFATAL(g_scan_progress == 0);
m_could_reserve = true;
return true;
}
@ -2265,6 +2266,7 @@ public:
~CoinsViewScanReserver() {
if (m_could_reserve) {
g_scan_in_progress = false;
g_scan_progress = 0;
}
}
};
@ -2381,7 +2383,6 @@ static RPCHelpMan scantxoutset()
std::vector<CTxOut> input_txos;
std::map<COutPoint, Coin> coins;
g_should_abort_scan = false;
g_scan_progress = 0;
int64_t count = 0;
std::unique_ptr<CCoinsViewCursor> pcursor;
CBlockIndex* tip;