Skip to content

Commit b326725

Browse files
committed
Move FopenFn to fsbridge namespace
[META] In a future commit in this patchset, it will be used by more than just validation, and it needs to align with fopen anyway.
1 parent ae1e8e3 commit b326725

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/fs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <cstdio>
1111
#include <filesystem>
12+
#include <functional>
1213
#include <iomanip>
1314
#include <ios>
1415
#include <ostream>
@@ -199,6 +200,7 @@ bool create_directories(const std::filesystem::path& p, std::error_code& ec) = d
199200

200201
/** Bridge operations to C stdio */
201202
namespace fsbridge {
203+
using FopenFn = std::function<FILE*(const fs::path&, const char*)>;
202204
FILE *fopen(const fs::path& p, const char *mode);
203205

204206
/**

src/validation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <consensus/validation.h>
1818
#include <cuckoocache.h>
1919
#include <flatfile.h>
20+
#include <fs.h>
2021
#include <hash.h>
2122
#include <kernel/coinstats.h>
2223
#include <logging.h>
@@ -64,6 +65,7 @@ using kernel::CCoinsStats;
6465
using kernel::CoinStatsHashType;
6566
using kernel::ComputeUTXOStats;
6667

68+
using fsbridge::FopenFn;
6769
using node::BLOCKFILE_CHUNK_SIZE;
6870
using node::BlockManager;
6971
using node::BlockMap;

src/validation.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,13 +1014,11 @@ bool DeploymentEnabled(const ChainstateManager& chainman, DEP dep)
10141014
return DeploymentEnabled(chainman.GetConsensus(), dep);
10151015
}
10161016

1017-
using FopenFn = std::function<FILE*(const fs::path&, const char*)>;
1018-
10191017
/** Dump the mempool to disk. */
1020-
bool DumpMempool(const CTxMemPool& pool, const fs::path& dump_path, FopenFn mockable_fopen_function = fsbridge::fopen, bool skip_file_commit = false);
1018+
bool DumpMempool(const CTxMemPool& pool, const fs::path& dump_path, fsbridge::FopenFn mockable_fopen_function = fsbridge::fopen, bool skip_file_commit = false);
10211019

10221020
/** Load the mempool from disk. */
1023-
bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, FopenFn mockable_fopen_function = fsbridge::fopen);
1021+
bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, fsbridge::FopenFn mockable_fopen_function = fsbridge::fopen);
10241022

10251023
/**
10261024
* Return the expected assumeutxo value for a given height, if one exists.

0 commit comments

Comments
 (0)