mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Merge bitcoin/bitcoin#25036: wallet: Save wallet scan progress
230a2f4cc3wallet test: Add unit test for wallet scan save_progress option (Ryan Ofsky)a89ddfbe22wallet: Save wallet scan progress (w0xlt) Pull request description: Currently, the wallet scan progress is not saved. If it is interrupted, it will be necessary to start from scratch on the next load. This PR changes this and the progress is saved right after checking a block. Close https://github.com/bitcoin/bitcoin/issues/25010 ACKs for top commit: furszy: re-ACK230a2f4achow101: ACK230a2f4cc3ryanofsky: Code review ACK230a2f4cc3. Only change since last review is tweaking whitespace and adding log print Tree-SHA512: 1a9dec207ed22b3443fb06a4daf967637bc02bcaf71c070b7dc33605d0cab959551e4014c9e92293a63f54c5cbcc98bb9f8844a8c60bc32a1482b1c4130fab32
This commit is contained in:
@@ -524,20 +524,27 @@ public:
|
||||
}
|
||||
bool haveBlockOnDisk(int height) override
|
||||
{
|
||||
LOCK(cs_main);
|
||||
LOCK(::cs_main);
|
||||
const CChain& active = Assert(m_node.chainman)->ActiveChain();
|
||||
CBlockIndex* block = active[height];
|
||||
return block && ((block->nStatus & BLOCK_HAVE_DATA) != 0) && block->nTx > 0;
|
||||
}
|
||||
CBlockLocator getTipLocator() override
|
||||
{
|
||||
LOCK(cs_main);
|
||||
LOCK(::cs_main);
|
||||
const CChain& active = Assert(m_node.chainman)->ActiveChain();
|
||||
return active.GetLocator();
|
||||
}
|
||||
CBlockLocator getActiveChainLocator(const uint256& block_hash) override
|
||||
{
|
||||
LOCK(::cs_main);
|
||||
const CBlockIndex* index = chainman().m_blockman.LookupBlockIndex(block_hash);
|
||||
if (!index) return {};
|
||||
return chainman().ActiveChain().GetLocator(index);
|
||||
}
|
||||
std::optional<int> findLocatorFork(const CBlockLocator& locator) override
|
||||
{
|
||||
LOCK(cs_main);
|
||||
LOCK(::cs_main);
|
||||
const CChainState& active = Assert(m_node.chainman)->ActiveChainstate();
|
||||
if (const CBlockIndex* fork = active.FindForkInGlobalIndex(locator)) {
|
||||
return fork->nHeight;
|
||||
@@ -593,7 +600,7 @@ public:
|
||||
void findCoins(std::map<COutPoint, Coin>& coins) override { return FindCoins(m_node, coins); }
|
||||
double guessVerificationProgress(const uint256& block_hash) override
|
||||
{
|
||||
LOCK(cs_main);
|
||||
LOCK(::cs_main);
|
||||
return GuessVerificationProgress(chainman().GetParams().TxData(), chainman().m_blockman.LookupBlockIndex(block_hash));
|
||||
}
|
||||
bool hasBlocks(const uint256& block_hash, int min_height, std::optional<int> max_height) override
|
||||
@@ -693,7 +700,7 @@ public:
|
||||
CFeeRate relayDustFee() override { return ::dustRelayFee; }
|
||||
bool havePruned() override
|
||||
{
|
||||
LOCK(cs_main);
|
||||
LOCK(::cs_main);
|
||||
return m_node.chainman->m_blockman.m_have_pruned;
|
||||
}
|
||||
bool isReadyToBroadcast() override { return !node::fImporting && !node::fReindex && !isInitialBlockDownload(); }
|
||||
|
||||
Reference in New Issue
Block a user