diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-07-04 18:59:49 +0200 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-09-15 14:33:51 +0200 |
commit | fa389d902fbf5fac19fba8c5d0c5e0a25f15ca63 (patch) | |
tree | d34f7fbba3507483e03c6d120ab23c930c2ddbdb /src/bench/load_external.cpp | |
parent | f608a409f7591b4f5cf170898bee58b9d9dcf1b6 (diff) | |
download | bitcoin-fa389d902fbf5fac19fba8c5d0c5e0a25f15ca63.tar.xz |
refactor: Drop unused fclose() from BufferedFile
This was only explicitly used in the tests, where it can be replaced by
wrapping the original raw file pointer into a CAutoFile on creation and
then calling CAutoFile::fclose().
Also, it was used in LoadExternalBlockFile(), where it can also be
replaced by the (implicit call to the) CAutoFile destructor after
wrapping the original raw file pointer in a CAutoFile.
Diffstat (limited to 'src/bench/load_external.cpp')
-rw-r--r-- | src/bench/load_external.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bench/load_external.cpp b/src/bench/load_external.cpp index 252cbb163b..7cfade9c79 100644 --- a/src/bench/load_external.cpp +++ b/src/bench/load_external.cpp @@ -5,6 +5,7 @@ #include <bench/bench.h> #include <bench/data.h> #include <chainparams.h> +#include <clientversion.h> #include <test/util/setup_common.h> #include <util/chaintype.h> #include <validation.h> @@ -54,8 +55,8 @@ static void LoadExternalBlockFile(benchmark::Bench& bench) bench.run([&] { // "rb" is "binary, O_RDONLY", positioned to the start of the file. // The file will be closed by LoadExternalBlockFile(). - FILE* file{fsbridge::fopen(blkfile, "rb")}; - testing_setup->m_node.chainman->LoadExternalBlockFile(file, &pos, &blocks_with_unknown_parent); + CAutoFile file{fsbridge::fopen(blkfile, "rb"), CLIENT_VERSION}; + testing_setup->m_node.chainman->LoadExternalBlockFile(file.Get(), &pos, &blocks_with_unknown_parent); }); fs::remove(blkfile); } |