@@ -2746,10 +2746,8 @@ static RPCHelpMan loadtxoutset()
2746
2746
" You can find more information on this process in the `assumeutxo` design "
2747
2747
" document (<https://github.com/bitcoin/bitcoin/blob/master/doc/design/assumeutxo.md>)." ,
2748
2748
{
2749
- {" path" ,
2750
- RPCArg::Type::STR,
2751
- RPCArg::Optional::NO,
2752
- " path to the snapshot file. If relative, will be prefixed by datadir." },
2749
+ {" path" , RPCArg::Type::STR, RPCArg::Optional::NO, " path to the snapshot file. If relative, will be prefixed by datadir." },
2750
+ {" in_memory" , RPCArg::Type::BOOL, RPCArg::Default{false }, " should we load snapshot in memory." },
2753
2751
},
2754
2752
RPCResult{
2755
2753
RPCResult::Type::OBJ, " " , " " ,
@@ -2768,6 +2766,10 @@ static RPCHelpMan loadtxoutset()
2768
2766
NodeContext& node = EnsureAnyNodeContext (request.context );
2769
2767
ChainstateManager& chainman = EnsureChainman (node);
2770
2768
fs::path path{AbsPathForConfigVal (EnsureArgsman (node), fs::u8path (request.params [0 ].get_str ()))};
2769
+ bool in_memory = true ;
2770
+ if (!request.params [1 ].isNull ()) {
2771
+ in_memory = request.params [1 ].get_bool ();
2772
+ }
2771
2773
2772
2774
FILE* file{fsbridge::fopen (path, " rb" )};
2773
2775
AutoFile afile{file};
@@ -2794,7 +2796,7 @@ static RPCHelpMan loadtxoutset()
2794
2796
strprintf (" The base block header (%s) must appear in the headers chain. Make sure all headers are syncing, and call this RPC again." ,
2795
2797
base_blockhash.ToString ()));
2796
2798
}
2797
- if (!chainman.ActivateSnapshot (afile, metadata, false )) {
2799
+ if (!chainman.ActivateSnapshot (afile, metadata, in_memory )) {
2798
2800
throw JSONRPCError (RPC_INTERNAL_ERROR, " Unable to load UTXO snapshot " + fs::PathToString (path));
2799
2801
}
2800
2802
0 commit comments