Merge bitcoin/bitcoin#22580: [0.21] Backport: Reset scantxoutset progress before inferring descriptors

080b47d9ce rpc: reset scantxoutset progress on finish (Pavol Rusnak)

Pull request description:

  Backport of #19362.

ACKs for top commit:
  achow101:
    Code Review ACK 080b47d9ce

Tree-SHA512: 1f58965393663bfc0796fc06ef846bc87521d04d79c2a62227acf4d466de649db7d244c8992a32aa1086e6bf0ac92fb8a5aeadf4673441fefa505e40c02d5daf
This commit is contained in:
fanquake 2021-07-30 10:20:35 +08:00
commit 52778f4245
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -2109,6 +2109,7 @@ public:
if (g_scan_in_progress.exchange(true)) {
return false;
}
CHECK_NONFATAL(g_scan_progress == 0);
m_could_reserve = true;
return true;
}
@ -2116,6 +2117,7 @@ public:
~CoinsViewScanReserver() {
if (m_could_reserve) {
g_scan_in_progress = false;
g_scan_progress = 0;
}
}
};
@ -2228,7 +2230,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;