From 34ad9d5f6cf9f0afdd7d2b7d31b268da8db1b085 Mon Sep 17 00:00:00 2001 From: random-zebra Date: Fri, 25 Sep 2020 19:38:29 +0200 Subject: [PATCH] [Cleanup] Fix cs_main in net_processing add extern declaration for now. cs_main will be removed from here. (Also fix AcceptBlockHeader method signature). --- src/net_processing.cpp | 1 + src/net_processing.h | 2 ++ src/validation.h | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index d22357016d2df..6b29e9d612a8f 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -27,6 +27,7 @@ struct COrphanTx { CTransaction tx; NodeId fromPeer; }; + std::map mapOrphanTransactions GUARDED_BY(cs_main); std::map > mapOrphanTransactionsByPrev GUARDED_BY(cs_main); diff --git a/src/net_processing.h b/src/net_processing.h index 1d5ee31e58174..c524e59ed7516 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -10,6 +10,8 @@ #include "net.h" #include "validationinterface.h" +extern RecursiveMutex cs_main; // !TODO: change mutex to cs_orphans + /** Default for -maxorphantx, maximum number of orphan transactions kept in memory */ static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100; /** Default for -blockspamfilter, use header spam filter */ diff --git a/src/validation.h b/src/validation.h index f9737633600ff..37c8dd3702039 100644 --- a/src/validation.h +++ b/src/validation.h @@ -341,7 +341,7 @@ bool TestBlockValidity(CValidationState& state, const CBlock& block, CBlockIndex /** Store block on disk. If dbp is provided, the file is known to already reside on disk */ bool AcceptBlock(const CBlock& block, CValidationState& state, CBlockIndex** pindex, CDiskBlockPos* dbp = NULL, bool fAlreadyCheckedBlock = false); -bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBlockIndex** ppindex = NULL); +bool AcceptBlockHeader(const CBlock& block, CValidationState& state, CBlockIndex** ppindex = NULL); /** RAII wrapper for VerifyDB: Verify consistency of the block and coin databases */