From 5e0b38e4c77b4777542082554181e7e82a5ff53c Mon Sep 17 00:00:00 2001 From: D33r-Gee Date: Mon, 28 Apr 2025 08:23:14 -0700 Subject: [PATCH] interface: Expose load utxo snapshot functionality Expose load/activate AssumeUTXO snapshot functionaility so that it can be laoded trhough the GUI. --- src/interfaces/node.h | 4 ++++ src/node/interfaces.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/interfaces/node.h b/src/interfaces/node.h index b7bcb431214..9381c346a27 100644 --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -10,6 +10,7 @@ #include // For BCLog::CategoryMask #include // For NodeId #include // For banmap_t +#include // For SnapshotMetadata #include // For Network #include // For ConnectionDirection #include // For SecureString @@ -205,6 +206,9 @@ class Node //! List rpc commands. virtual std::vector listRpcCommands() = 0; + //! Load and activate a snapshot file + virtual bool loadSnapshot(AutoFile& coins_file, const node::SnapshotMetadata& metadata, bool in_memory) = 0; + //! Set RPC timer interface if unset. virtual void rpcSetTimerInterfaceIfUnset(RPCTimerInterface* iface) = 0; diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index 8aec2758f8b..535cbcb740a 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -355,6 +355,11 @@ class NodeImpl : public Node return ::tableRPC.execute(req); } std::vector listRpcCommands() override { return ::tableRPC.listCommands(); } + bool loadSnapshot(AutoFile& coins_file, const SnapshotMetadata& metadata, bool in_memory) override + { + auto activation_result{chainman().ActivateSnapshot(coins_file, metadata, in_memory)}; + return activation_result.has_value(); + } void rpcSetTimerInterfaceIfUnset(RPCTimerInterface* iface) override { RPCSetTimerInterfaceIfUnset(iface); } void rpcUnsetTimerInterface(RPCTimerInterface* iface) override { RPCUnsetTimerInterface(iface); } std::optional getUnspentOutput(const COutPoint& output) override