aboutsummaryrefslogtreecommitdiff
path: root/src/test/denialofservice_tests.cpp
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2018-08-30 16:33:02 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2018-08-30 16:36:26 +0200
commitb602c9b3af284995d0f89b4c676f6f6c5316c9a2 (patch)
tree081406f2b745bab6f33bd37e779372964220b83e /src/test/denialofservice_tests.cpp
parent07033a8f91975028e366920b0da3f7e2a6ef9cbd (diff)
tests: Add missing locking annotations and locks
Diffstat (limited to 'src/test/denialofservice_tests.cpp')
-rw-r--r--src/test/denialofservice_tests.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/test/denialofservice_tests.cpp b/src/test/denialofservice_tests.cpp
index fdf7397bff..52bbe96b96 100644
--- a/src/test/denialofservice_tests.cpp
+++ b/src/test/denialofservice_tests.cpp
@@ -31,7 +31,8 @@ struct COrphanTx {
NodeId fromPeer;
int64_t nTimeExpire;
};
-extern std::map<uint256, COrphanTx> mapOrphanTransactions;
+extern CCriticalSection g_cs_orphans;
+extern std::map<uint256, COrphanTx> mapOrphanTransactions GUARDED_BY(g_cs_orphans);
static CService ip(uint32_t i)
{
@@ -324,7 +325,7 @@ BOOST_AUTO_TEST_CASE(DoS_bantime)
static CTransactionRef RandomOrphan()
{
std::map<uint256, COrphanTx>::iterator it;
- LOCK(cs_main);
+ LOCK2(cs_main, g_cs_orphans);
it = mapOrphanTransactions.lower_bound(InsecureRand256());
if (it == mapOrphanTransactions.end())
it = mapOrphanTransactions.begin();
@@ -394,7 +395,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans)
BOOST_CHECK(!AddOrphanTx(MakeTransactionRef(tx), i));
}
- LOCK(cs_main);
+ LOCK2(cs_main, g_cs_orphans);
// Test EraseOrphansFor:
for (NodeId i = 0; i < 3; i++)
{