aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-01-26 16:25:58 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-01-28 19:26:27 +0000
commit5e20e9ec3859205c220867ca49efb752b8edaacc (patch)
tree71f39737c772a614ee17956dbb023711315ea6aa
parente3699b71c46bf66cfe363fc76ab8761dc39555a7 (diff)
downloadbitcoin-5e20e9ec3859205c220867ca49efb752b8edaacc.tar.xz
Prevent possible concurrent CBanDB::Write() calls
-rw-r--r--src/banman.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/banman.cpp b/src/banman.cpp
index 95b927c1ff..7fa489b051 100644
--- a/src/banman.cpp
+++ b/src/banman.cpp
@@ -7,6 +7,7 @@
#include <netaddress.h>
#include <node/ui_interface.h>
+#include <sync.h>
#include <util/system.h>
#include <util/time.h>
#include <util/translation.h>
@@ -39,6 +40,9 @@ BanMan::~BanMan()
void BanMan::DumpBanlist()
{
+ static Mutex dump_mutex;
+ LOCK(dump_mutex);
+
SweepBanned(); // clean unused entries (if bantime has expired)
if (!BannedSetIsDirty()) return;