Skip to content

Commit 5e0b38e

Browse files
committed
interface: Expose load utxo snapshot functionality
Expose load/activate AssumeUTXO snapshot functionaility so that it can be laoded trhough the GUI.
1 parent d62c2d8 commit 5e0b38e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/interfaces/node.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <logging.h> // For BCLog::CategoryMask
1111
#include <net.h> // For NodeId
1212
#include <net_types.h> // For banmap_t
13+
#include <node/utxo_snapshot.h> // For SnapshotMetadata
1314
#include <netaddress.h> // For Network
1415
#include <netbase.h> // For ConnectionDirection
1516
#include <support/allocators/secure.h> // For SecureString
@@ -205,6 +206,9 @@ class Node
205206
//! List rpc commands.
206207
virtual std::vector<std::string> listRpcCommands() = 0;
207208

209+
//! Load and activate a snapshot file
210+
virtual bool loadSnapshot(AutoFile& coins_file, const node::SnapshotMetadata& metadata, bool in_memory) = 0;
211+
208212
//! Set RPC timer interface if unset.
209213
virtual void rpcSetTimerInterfaceIfUnset(RPCTimerInterface* iface) = 0;
210214

src/node/interfaces.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,11 @@ class NodeImpl : public Node
355355
return ::tableRPC.execute(req);
356356
}
357357
std::vector<std::string> listRpcCommands() override { return ::tableRPC.listCommands(); }
358+
bool loadSnapshot(AutoFile& coins_file, const SnapshotMetadata& metadata, bool in_memory) override
359+
{
360+
auto activation_result{chainman().ActivateSnapshot(coins_file, metadata, in_memory)};
361+
return activation_result.has_value();
362+
}
358363
void rpcSetTimerInterfaceIfUnset(RPCTimerInterface* iface) override { RPCSetTimerInterfaceIfUnset(iface); }
359364
void rpcUnsetTimerInterface(RPCTimerInterface* iface) override { RPCUnsetTimerInterface(iface); }
360365
std::optional<Coin> getUnspentOutput(const COutPoint& output) override

0 commit comments

Comments
 (0)