Skip to content

Commit 42d5d53

Browse files
committed
interfaces: Add helper function for wallet on pruning
1 parent 228aba2 commit 42d5d53

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/interfaces/chain.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ class Chain
289289
//! Check if any block has been pruned.
290290
virtual bool havePruned() = 0;
291291

292+
//! Get the current prune height.
293+
virtual std::optional<int> getPruneHeight() = 0;
294+
292295
//! Check if the node is ready to broadcast transactions.
293296
virtual bool isReadyToBroadcast() = 0;
294297

src/node/interfaces.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include <policy/settings.h>
4747
#include <primitives/block.h>
4848
#include <primitives/transaction.h>
49+
#include <rpc/blockchain.h>
4950
#include <rpc/protocol.h>
5051
#include <rpc/server.h>
5152
#include <support/allocators/secure.h>
@@ -770,6 +771,11 @@ class ChainImpl : public Chain
770771
LOCK(::cs_main);
771772
return chainman().m_blockman.m_have_pruned;
772773
}
774+
std::optional<int> getPruneHeight() override
775+
{
776+
LOCK(chainman().GetMutex());
777+
return GetPruneHeight(chainman().m_blockman, chainman().ActiveChain());
778+
}
773779
bool isReadyToBroadcast() override { return !chainman().m_blockman.LoadingBlocks() && !isInitialBlockDownload(); }
774780
bool isInitialBlockDownload() override
775781
{

0 commit comments

Comments
 (0)