mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-05 02:33:07 +02:00
rpc: take ownership of the file by WriteUTXOSnapshot()
Have `WriteUTXOSnapshot()` take rvalue reference to make it obvious that it takes ownership of the file.
This commit is contained in:
@@ -47,8 +47,11 @@ CreateAndActivateUTXOSnapshot(
|
||||
FILE* outfile{fsbridge::fopen(snapshot_path, "wb")};
|
||||
AutoFile auto_outfile{outfile};
|
||||
|
||||
UniValue result = CreateUTXOSnapshot(
|
||||
node, node.chainman->ActiveChainstate(), auto_outfile, snapshot_path, snapshot_path);
|
||||
UniValue result = CreateUTXOSnapshot(node,
|
||||
node.chainman->ActiveChainstate(),
|
||||
std::move(auto_outfile), // Will close auto_outfile.
|
||||
snapshot_path,
|
||||
snapshot_path);
|
||||
LogPrintf(
|
||||
"Wrote UTXO snapshot to %s: %s\n", fs::PathToString(snapshot_path.make_preferred()), result.write());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user