Skip to content

Commit 00b16bc

Browse files
committed
Merge pull request #4546
09c744c Make sure CAutoFile for fees estimate goes out of scope (Pieter Wuille)
2 parents 87e4079 + 09c744c commit 00b16bc

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/init.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,14 @@ void Shutdown()
127127
StopNode();
128128
UnregisterNodeSignals(GetNodeSignals());
129129

130-
boost::filesystem::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME;
131-
CAutoFile est_fileout = CAutoFile(fopen(est_path.string().c_str(), "wb"), SER_DISK, CLIENT_VERSION);
132-
if (est_fileout)
133-
mempool.WriteFeeEstimates(est_fileout);
134-
else
135-
LogPrintf("%s: Failed to write fee estimates to %s\n", __func__, est_path.string());
130+
{
131+
boost::filesystem::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME;
132+
CAutoFile est_fileout(fopen(est_path.string().c_str(), "wb"), SER_DISK, CLIENT_VERSION);
133+
if (est_fileout)
134+
mempool.WriteFeeEstimates(est_fileout);
135+
else
136+
LogPrintf("%s: Failed to write fee estimates to %s\n", __func__, est_path.string());
137+
}
136138

137139
{
138140
LOCK(cs_main);

0 commit comments

Comments
 (0)