From b3267258b052557fc136b9a4dcb754afb9219470 Mon Sep 17 00:00:00 2001 From: Carl Dong Date: Wed, 13 Jul 2022 12:32:43 -0400 Subject: [PATCH] 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. --- src/fs.h | 2 ++ src/validation.cpp | 2 ++ src/validation.h | 6 ++---- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/fs.h b/src/fs.h index cc55793b951..e8b34319bbe 100644 --- a/src/fs.h +++ b/src/fs.h @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -199,6 +200,7 @@ bool create_directories(const std::filesystem::path& p, std::error_code& ec) = d /** Bridge operations to C stdio */ namespace fsbridge { + using FopenFn = std::function; FILE *fopen(const fs::path& p, const char *mode); /** diff --git a/src/validation.cpp b/src/validation.cpp index 1d24f14dd8b..b757fed055a 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -64,6 +65,7 @@ using kernel::CCoinsStats; using kernel::CoinStatsHashType; using kernel::ComputeUTXOStats; +using fsbridge::FopenFn; using node::BLOCKFILE_CHUNK_SIZE; using node::BlockManager; using node::BlockMap; diff --git a/src/validation.h b/src/validation.h index a1901cd782a..711fc746e20 100644 --- a/src/validation.h +++ b/src/validation.h @@ -1014,13 +1014,11 @@ bool DeploymentEnabled(const ChainstateManager& chainman, DEP dep) return DeploymentEnabled(chainman.GetConsensus(), dep); } -using FopenFn = std::function; - /** Dump the mempool to disk. */ -bool DumpMempool(const CTxMemPool& pool, const fs::path& dump_path, FopenFn mockable_fopen_function = fsbridge::fopen, bool skip_file_commit = false); +bool DumpMempool(const CTxMemPool& pool, const fs::path& dump_path, fsbridge::FopenFn mockable_fopen_function = fsbridge::fopen, bool skip_file_commit = false); /** Load the mempool from disk. */ -bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, FopenFn mockable_fopen_function = fsbridge::fopen); +bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, fsbridge::FopenFn mockable_fopen_function = fsbridge::fopen); /** * Return the expected assumeutxo value for a given height, if one exists.