mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
interfaces: Add helper function for wallet on pruning
This commit is contained in:
parent
228aba2c4d
commit
42d5d53363
2 changed files with 9 additions and 0 deletions
|
@ -289,6 +289,9 @@ public:
|
||||||
//! Check if any block has been pruned.
|
//! Check if any block has been pruned.
|
||||||
virtual bool havePruned() = 0;
|
virtual bool havePruned() = 0;
|
||||||
|
|
||||||
|
//! Get the current prune height.
|
||||||
|
virtual std::optional<int> getPruneHeight() = 0;
|
||||||
|
|
||||||
//! Check if the node is ready to broadcast transactions.
|
//! Check if the node is ready to broadcast transactions.
|
||||||
virtual bool isReadyToBroadcast() = 0;
|
virtual bool isReadyToBroadcast() = 0;
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include <policy/settings.h>
|
#include <policy/settings.h>
|
||||||
#include <primitives/block.h>
|
#include <primitives/block.h>
|
||||||
#include <primitives/transaction.h>
|
#include <primitives/transaction.h>
|
||||||
|
#include <rpc/blockchain.h>
|
||||||
#include <rpc/protocol.h>
|
#include <rpc/protocol.h>
|
||||||
#include <rpc/server.h>
|
#include <rpc/server.h>
|
||||||
#include <support/allocators/secure.h>
|
#include <support/allocators/secure.h>
|
||||||
|
@ -770,6 +771,11 @@ public:
|
||||||
LOCK(::cs_main);
|
LOCK(::cs_main);
|
||||||
return chainman().m_blockman.m_have_pruned;
|
return chainman().m_blockman.m_have_pruned;
|
||||||
}
|
}
|
||||||
|
std::optional<int> getPruneHeight() override
|
||||||
|
{
|
||||||
|
LOCK(chainman().GetMutex());
|
||||||
|
return GetPruneHeight(chainman().m_blockman, chainman().ActiveChain());
|
||||||
|
}
|
||||||
bool isReadyToBroadcast() override { return !chainman().m_blockman.LoadingBlocks() && !isInitialBlockDownload(); }
|
bool isReadyToBroadcast() override { return !chainman().m_blockman.LoadingBlocks() && !isInitialBlockDownload(); }
|
||||||
bool isInitialBlockDownload() override
|
bool isInitialBlockDownload() override
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue