@@ -2750,6 +2750,10 @@ static RPCHelpMan loadtxoutset()
2750
2750
RPCArg::Type::STR,
2751
2751
RPCArg::Optional::NO,
2752
2752
" path to the snapshot file. If relative, will be prefixed by datadir." },
2753
+ {" in_memory" ,
2754
+ RPCArg::Type::BOOL,
2755
+ RPCArg::Optional::OMITTED,
2756
+ " should we load snapshot in memory." }
2753
2757
},
2754
2758
RPCResult{
2755
2759
RPCResult::Type::OBJ, " " , " " ,
@@ -2761,13 +2765,15 @@ static RPCHelpMan loadtxoutset()
2761
2765
}
2762
2766
},
2763
2767
RPCExamples{
2764
- HelpExampleCli (" loadtxoutset" , " utxo.dat" )
2768
+ HelpExampleCli (" loadtxoutset" , " utxo.dat" ) +
2769
+ HelpExampleCli (" dumptxoutset" , " \" utxo.dat\" \" true\" " ),
2765
2770
},
2766
2771
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
2767
2772
{
2768
2773
NodeContext& node = EnsureAnyNodeContext (request.context );
2769
2774
ChainstateManager& chainman = EnsureChainman (node);
2770
2775
fs::path path{AbsPathForConfigVal (EnsureArgsman (node), fs::u8path (request.params [0 ].get_str ()))};
2776
+ bool in_memory{request.params [1 ].isNull () ? false : request.params [1 ].get_bool ()};
2771
2777
2772
2778
FILE* file{fsbridge::fopen (path, " rb" )};
2773
2779
AutoFile afile{file};
@@ -2794,7 +2800,7 @@ static RPCHelpMan loadtxoutset()
2794
2800
strprintf (" The base block header (%s) must appear in the headers chain. Make sure all headers are syncing, and call this RPC again." ,
2795
2801
base_blockhash.ToString ()));
2796
2802
}
2797
- if (!chainman.ActivateSnapshot (afile, metadata, false )) {
2803
+ if (!chainman.ActivateSnapshot (afile, metadata, in_memory )) {
2798
2804
throw JSONRPCError (RPC_INTERNAL_ERROR, " Unable to load UTXO snapshot " + fs::PathToString (path));
2799
2805
}
2800
2806
0 commit comments