mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
refactor: re-order headers and forward declarations to improve compile time (#5693)
## Issue being fixed or feature implemented Some headers include other heavy headers, such as `logging.h`, `tinyformat.h`, `iostream`. These headers are heavy and increase compilation time on scale of whole project drastically because can be used in many other headers. ## What was done? Moved many heavy includes from headers to cpp files to optimize compilation time. In some places added forward declarations if it is reasonable. As side effect removed 2 circular dependencies: ``` "llmq/debug -> llmq/dkgsessionhandler -> llmq/debug" "llmq/debug -> llmq/dkgsessionhandler -> llmq/dkgsession -> llmq/debug" ``` ## How Has This Been Tested? Run build 2 times before refactoring and after refactoring: `make clean && sleep 10s; time make -j18` Before refactoring: ``` real 5m37,826s user 77m12,075s sys 6m20,547s real 5m32,626s user 76m51,143s sys 6m24,511s ``` After refactoring: ``` real 5m18,509s user 73m32,133s sys 6m21,590s real 5m14,466s user 73m20,942s sys 6m17,868s ``` ~5% of improvement for compilation time. That's not huge, but that's worth to get merged There're several more refactorings TODO but better to do them later by backports: - bitcoin/bitcoin#27636 - bitcoin/bitcoin#26286 - bitcoin/bitcoin#27238 - and maybe this one: bitcoin/bitcoin#28200 ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone
This commit is contained in:
parent
7fc8a04e1c
commit
ba97f49f2f
@ -427,10 +427,12 @@ libbitcoin_server_a_SOURCES = \
|
||||
init.cpp \
|
||||
governance/governance.cpp \
|
||||
governance/classes.cpp \
|
||||
governance/exceptions.cpp \
|
||||
governance/object.cpp \
|
||||
governance/validators.cpp \
|
||||
governance/vote.cpp \
|
||||
governance/votedb.cpp \
|
||||
gsl/assert.cpp \
|
||||
llmq/quorums.cpp \
|
||||
llmq/blockprocessor.cpp \
|
||||
llmq/commitment.cpp \
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include <fs.h>
|
||||
#include <hash.h>
|
||||
#include <iostream>
|
||||
#include <ios>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
|
@ -5,6 +5,26 @@
|
||||
|
||||
#include <chain.h>
|
||||
|
||||
#include <tinyformat.h>
|
||||
|
||||
std::string CDiskBlockIndex::ToString() const
|
||||
{
|
||||
std::string str = "CDiskBlockIndex(";
|
||||
str += CBlockIndex::ToString();
|
||||
str += strprintf("\n hashBlock=%s, hashPrev=%s)",
|
||||
GetBlockHash().ToString(),
|
||||
hashPrev.ToString());
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string CBlockIndex::ToString() const
|
||||
{
|
||||
return strprintf("CBlockIndex(pprev=%p, nHeight=%d, merkle=%s, hashBlock=%s)",
|
||||
pprev, nHeight,
|
||||
hashMerkleRoot.ToString(),
|
||||
GetBlockHash().ToString());
|
||||
}
|
||||
|
||||
/**
|
||||
* CChain implementation
|
||||
*/
|
||||
|
19
src/chain.h
19
src/chain.h
@ -10,7 +10,6 @@
|
||||
#include <consensus/params.h>
|
||||
#include <flatfile.h>
|
||||
#include <primitives/block.h>
|
||||
#include <tinyformat.h>
|
||||
#include <uint256.h>
|
||||
|
||||
#include <vector>
|
||||
@ -281,13 +280,7 @@ public:
|
||||
return pbegin[(pend - pbegin)/2];
|
||||
}
|
||||
|
||||
std::string ToString() const
|
||||
{
|
||||
return strprintf("CBlockIndex(pprev=%p, nHeight=%d, merkle=%s, hashBlock=%s)",
|
||||
pprev, nHeight,
|
||||
hashMerkleRoot.ToString(),
|
||||
GetBlockHash().ToString());
|
||||
}
|
||||
std::string ToString() const;
|
||||
|
||||
//! Check whether this block index entry is valid up to the passed validity level.
|
||||
bool IsValid(enum BlockStatus nUpTo = BLOCK_VALID_TRANSACTIONS) const
|
||||
@ -381,16 +374,8 @@ public:
|
||||
return block.GetHash();
|
||||
}
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
std::string ToString() const
|
||||
{
|
||||
std::string str = "CDiskBlockIndex(";
|
||||
str += CBlockIndex::ToString();
|
||||
str += strprintf("\n hashBlock=%s, hashPrev=%s)",
|
||||
GetBlockHash().ToString(),
|
||||
hashPrev.ToString());
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
/** An in-memory indexed chain of blocks. */
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <net_processing.h>
|
||||
#include <netmessagemaker.h>
|
||||
#include <shutdown.h>
|
||||
#include <util/check.h>
|
||||
#include <util/irange.h>
|
||||
#include <util/moneystr.h>
|
||||
#include <util/ranges.h>
|
||||
@ -155,6 +156,15 @@ void CCoinJoinClientManager::ProcessMessage(CNode& peer, PeerManager& peerman, C
|
||||
}
|
||||
}
|
||||
|
||||
CCoinJoinClientSession::CCoinJoinClientSession(CWallet& pwallet, CJClientManager& clientman, const CMasternodeSync& mn_sync,
|
||||
const std::unique_ptr<CCoinJoinClientQueueManager>& queueman) :
|
||||
m_wallet(pwallet),
|
||||
m_clientman(clientman),
|
||||
m_manager(*Assert(clientman.Get(pwallet))),
|
||||
m_mn_sync(mn_sync),
|
||||
m_queueman(queueman)
|
||||
{}
|
||||
|
||||
void CCoinJoinClientSession::ProcessMessage(CNode& peer, PeerManager& peerman, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv)
|
||||
{
|
||||
if (fMasternodeMode) return;
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include <coinjoin/util.h>
|
||||
#include <coinjoin/coinjoin.h>
|
||||
#include <util/check.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <atomic>
|
||||
@ -165,8 +164,7 @@ private:
|
||||
|
||||
public:
|
||||
explicit CCoinJoinClientSession(CWallet& pwallet, CJClientManager& clientman, const CMasternodeSync& mn_sync,
|
||||
const std::unique_ptr<CCoinJoinClientQueueManager>& queueman) :
|
||||
m_wallet(pwallet), m_clientman(clientman), m_manager(*Assert(clientman.Get(pwallet))), m_mn_sync(mn_sync), m_queueman(queueman) {}
|
||||
const std::unique_ptr<CCoinJoinClientQueueManager>& queueman);
|
||||
|
||||
void ProcessMessage(CNode& peer, PeerManager& peerman, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv);
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <util/translation.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <tinyformat.h>
|
||||
#include <string>
|
||||
|
||||
constexpr static CAmount DEFAULT_MAX_RAW_TX_FEE{COIN / 10};
|
||||
@ -87,6 +88,12 @@ bool CCoinJoinQueue::IsTimeOutOfBounds(int64_t current_time) const
|
||||
nTime - current_time > COINJOIN_QUEUE_TIMEOUT;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string CCoinJoinQueue::ToString() const
|
||||
{
|
||||
return strprintf("nDenom=%d, nTime=%lld, fReady=%s, fTried=%s, masternode=%s",
|
||||
nDenom, nTime, fReady ? "true" : "false", fTried ? "true" : "false", masternodeOutpoint.ToStringShort());
|
||||
}
|
||||
|
||||
uint256 CCoinJoinBroadcastTx::GetSignatureHash() const
|
||||
{
|
||||
return SerializeHash(*this, SER_GETHASH, PROTOCOL_VERSION);
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <primitives/transaction.h>
|
||||
#include <sync.h>
|
||||
#include <timedata.h>
|
||||
#include <tinyformat.h>
|
||||
#include <univalue.h>
|
||||
#include <util/ranges.h>
|
||||
#include <util/translation.h>
|
||||
@ -238,11 +237,7 @@ public:
|
||||
/// Check if a queue is too old or too far into the future
|
||||
[[nodiscard]] bool IsTimeOutOfBounds(int64_t current_time = GetAdjustedTime()) const;
|
||||
|
||||
[[nodiscard]] std::string ToString() const
|
||||
{
|
||||
return strprintf("nDenom=%d, nTime=%lld, fReady=%s, fTried=%s, masternode=%s",
|
||||
nDenom, nTime, fReady ? "true" : "false", fTried ? "true" : "false", masternodeOutpoint.ToStringShort());
|
||||
}
|
||||
[[nodiscard]] std::string ToString() const;
|
||||
|
||||
friend bool operator==(const CCoinJoinQueue& a, const CCoinJoinQueue& b)
|
||||
{
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <script/interpreter.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <evo/assetlocktx.h>
|
||||
#include <tinyformat.h>
|
||||
|
||||
// TODO remove the following dependencies
|
||||
#include <chain.h>
|
||||
|
@ -5,18 +5,18 @@
|
||||
#include <evo/assetlocktx.h>
|
||||
#include <evo/specialtx.h>
|
||||
|
||||
#include <consensus/params.h>
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <logging.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <llmq/commitment.h>
|
||||
#include <llmq/signing.h>
|
||||
#include <llmq/utils.h>
|
||||
#include <llmq/quorums.h>
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <consensus/params.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <logging.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/ranges_set.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -6,19 +6,17 @@
|
||||
#define BITCOIN_EVO_ASSETLOCKTX_H
|
||||
|
||||
#include <bls/bls_ies.h>
|
||||
#include <evo/specialtx.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <gsl/pointers.h>
|
||||
|
||||
#include <key_io.h>
|
||||
#include <serialize.h>
|
||||
#include <tinyformat.h>
|
||||
#include <univalue.h>
|
||||
|
||||
#include <optional>
|
||||
|
||||
class CBlockIndex;
|
||||
class CRangesSet;
|
||||
class TxValidationState;
|
||||
|
||||
class CAssetLockPayload
|
||||
{
|
||||
|
@ -6,12 +6,14 @@
|
||||
|
||||
#include <evo/assetlocktx.h>
|
||||
#include <evo/cbtx.h>
|
||||
#include <evo/specialtx.h>
|
||||
|
||||
#include <chain.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <llmq/utils.h>
|
||||
#include <logging.h>
|
||||
#include <validation.h>
|
||||
#include <node/blockstorage.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <exception>
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <unordered_set>
|
||||
|
||||
class CBlockIndex;
|
||||
class BlockValidationState;
|
||||
class TxValidationState;
|
||||
|
||||
namespace Consensus
|
||||
|
@ -6,9 +6,8 @@
|
||||
#define BITCOIN_EVO_DMN_TYPES_H
|
||||
|
||||
#include <amount.h>
|
||||
#include <serialize.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <limits>
|
||||
#include <string_view>
|
||||
|
||||
enum class MnType : uint16_t {
|
||||
@ -18,6 +17,7 @@ enum class MnType : uint16_t {
|
||||
Invalid = std::numeric_limits<uint16_t>::max(),
|
||||
};
|
||||
|
||||
template<typename T> struct is_serializable_enum;
|
||||
template<> struct is_serializable_enum<MnType> : std::true_type {};
|
||||
|
||||
namespace dmn_types {
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include <evo/evodb.h>
|
||||
|
||||
#include <uint256.h>
|
||||
|
||||
CEvoDBScopedCommitter::CEvoDBScopedCommitter(CEvoDB &_evoDB) :
|
||||
evoDB(_evoDB)
|
||||
{
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include <dbwrapper.h>
|
||||
#include <sync.h>
|
||||
#include <uint256.h>
|
||||
|
||||
class uint256;
|
||||
// "b_b" was used in the initial version of deterministic MN storage
|
||||
// "b_b2" was used after compact diffs were introduced
|
||||
// "b_b3" was used after masternode type introduction in evoDB
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <consensus/validation.h>
|
||||
#include <hash.h>
|
||||
#include <script/standard.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/underlying.h>
|
||||
|
||||
bool CProRegTx::IsTriviallyValid(bool is_basic_scheme_active, TxValidationState& state) const
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <key_io.h>
|
||||
#include <netaddress.h>
|
||||
#include <pubkey.h>
|
||||
#include <tinyformat.h>
|
||||
#include <univalue.h>
|
||||
#include <util/underlying.h>
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
#ifndef BITCOIN_EVO_SPECIALTX_H
|
||||
#define BITCOIN_EVO_SPECIALTX_H
|
||||
|
||||
#include <consensus/validation.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <serialize.h>
|
||||
#include <streams.h>
|
||||
|
42
src/governance/exceptions.cpp
Normal file
42
src/governance/exceptions.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2023 The Dash Core developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <governance/exceptions.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, governance_exception_type_enum_t eType)
|
||||
{
|
||||
switch (eType) {
|
||||
case GOVERNANCE_EXCEPTION_NONE:
|
||||
os << "GOVERNANCE_EXCEPTION_NONE";
|
||||
break;
|
||||
case GOVERNANCE_EXCEPTION_WARNING:
|
||||
os << "GOVERNANCE_EXCEPTION_WARNING";
|
||||
break;
|
||||
case GOVERNANCE_EXCEPTION_PERMANENT_ERROR:
|
||||
os << "GOVERNANCE_EXCEPTION_PERMANENT_ERROR";
|
||||
break;
|
||||
case GOVERNANCE_EXCEPTION_TEMPORARY_ERROR:
|
||||
os << "GOVERNANCE_EXCEPTION_TEMPORARY_ERROR";
|
||||
break;
|
||||
case GOVERNANCE_EXCEPTION_INTERNAL_ERROR:
|
||||
os << "GOVERNANCE_EXCEPTION_INTERNAL_ERROR";
|
||||
break;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
CGovernanceException::CGovernanceException(const std::string& strMessageIn,
|
||||
governance_exception_type_enum_t eTypeIn,
|
||||
int nNodePenaltyIn) :
|
||||
strMessage(),
|
||||
eType(eTypeIn),
|
||||
nNodePenalty(nNodePenaltyIn)
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
ostr << eType << ":" << strMessageIn;
|
||||
strMessage = ostr.str();
|
||||
}
|
@ -6,8 +6,7 @@
|
||||
#define BITCOIN_GOVERNANCE_EXCEPTIONS_H
|
||||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <iosfwd> // for ostream
|
||||
#include <string>
|
||||
|
||||
enum governance_exception_type_enum_t {
|
||||
@ -23,27 +22,7 @@ enum governance_exception_type_enum_t {
|
||||
GOVERNANCE_EXCEPTION_INTERNAL_ERROR = 4
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, governance_exception_type_enum_t eType)
|
||||
{
|
||||
switch (eType) {
|
||||
case GOVERNANCE_EXCEPTION_NONE:
|
||||
os << "GOVERNANCE_EXCEPTION_NONE";
|
||||
break;
|
||||
case GOVERNANCE_EXCEPTION_WARNING:
|
||||
os << "GOVERNANCE_EXCEPTION_WARNING";
|
||||
break;
|
||||
case GOVERNANCE_EXCEPTION_PERMANENT_ERROR:
|
||||
os << "GOVERNANCE_EXCEPTION_PERMANENT_ERROR";
|
||||
break;
|
||||
case GOVERNANCE_EXCEPTION_TEMPORARY_ERROR:
|
||||
os << "GOVERNANCE_EXCEPTION_TEMPORARY_ERROR";
|
||||
break;
|
||||
case GOVERNANCE_EXCEPTION_INTERNAL_ERROR:
|
||||
os << "GOVERNANCE_EXCEPTION_INTERNAL_ERROR";
|
||||
break;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& os, governance_exception_type_enum_t eType);
|
||||
|
||||
/**
|
||||
* A class which encapsulates information about a governance exception condition
|
||||
@ -64,15 +43,7 @@ private:
|
||||
public:
|
||||
explicit CGovernanceException(const std::string& strMessageIn = "",
|
||||
governance_exception_type_enum_t eTypeIn = GOVERNANCE_EXCEPTION_NONE,
|
||||
int nNodePenaltyIn = 0) :
|
||||
strMessage(),
|
||||
eType(eTypeIn),
|
||||
nNodePenalty(nNodePenaltyIn)
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
ostr << eType << ":" << strMessageIn;
|
||||
strMessage = ostr.str();
|
||||
}
|
||||
int nNodePenaltyIn = 0);
|
||||
|
||||
~CGovernanceException() noexcept override = default;
|
||||
|
||||
|
@ -1370,6 +1370,19 @@ void CGovernanceManager::InitOnLoad()
|
||||
LogPrintf(" %s\n", ToString());
|
||||
}
|
||||
|
||||
void GovernanceStore::Clear()
|
||||
{
|
||||
LOCK(cs);
|
||||
|
||||
LogPrint(BCLog::GOBJECT, "Governance object manager was cleared\n");
|
||||
mapObjects.clear();
|
||||
mapErasedGovernanceObjects.clear();
|
||||
cmapVoteToObject.Clear();
|
||||
cmapInvalidVotes.Clear();
|
||||
cmmapOrphanVotes.Clear();
|
||||
mapLastMasternodeObject.clear();
|
||||
}
|
||||
|
||||
std::string GovernanceStore::ToString() const
|
||||
{
|
||||
LOCK(cs);
|
||||
|
@ -208,18 +208,7 @@ public:
|
||||
>> *lastMNListForVotingKeys;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
LOCK(cs);
|
||||
|
||||
LogPrint(BCLog::GOBJECT, "Governance object manager was cleared\n");
|
||||
mapObjects.clear();
|
||||
mapErasedGovernanceObjects.clear();
|
||||
cmapVoteToObject.Clear();
|
||||
cmapInvalidVotes.Clear();
|
||||
cmmapOrphanVotes.Clear();
|
||||
mapLastMasternodeObject.clear();
|
||||
}
|
||||
void Clear();
|
||||
|
||||
std::string ToString() const;
|
||||
};
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <governance/exceptions.h>
|
||||
#include <governance/vote.h>
|
||||
#include <governance/votedb.h>
|
||||
#include <logging.h>
|
||||
#include <sync.h>
|
||||
#include <util/underlying.h>
|
||||
|
||||
@ -311,9 +310,7 @@ public:
|
||||
}
|
||||
if (s.GetType() & SER_DISK) {
|
||||
// Only include these for the disk file format
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceObject::SerializationOp Reading/writing votes from/to disk\n");
|
||||
READWRITE(obj.nDeletionTime, obj.fExpired, obj.mapCurrentMNVotes, obj.fileVotes);
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceObject::SerializationOp hash = %s, vote count = %d\n", obj.GetHash().ToString(), obj.fileVotes.GetVoteCount());
|
||||
}
|
||||
|
||||
// AFTER DESERIALIZATION OCCURS, CACHED VARIABLES MUST BE CALCULATED MANUALLY
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define BITCOIN_GOVERNANCE_VOTE_H
|
||||
|
||||
#include <primitives/transaction.h>
|
||||
#include <uint256.h>
|
||||
|
||||
class CGovernanceVote;
|
||||
class CBLSPublicKey;
|
||||
|
@ -5,14 +5,15 @@
|
||||
#ifndef BITCOIN_GOVERNANCE_VOTEDB_H
|
||||
#define BITCOIN_GOVERNANCE_VOTEDB_H
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
#include <governance/vote.h>
|
||||
#include <serialize.h>
|
||||
#include <streams.h>
|
||||
#include <uint256.h>
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* Represents the collection of votes associated with a given CGovernanceObject
|
||||
* Recently received votes are held in memory until a maximum size is reached after
|
||||
|
43
src/gsl/assert.cpp
Normal file
43
src/gsl/assert.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2023 The Dash Core developers
|
||||
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// This code is licensed under the MIT License (MIT).
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <gsl/assert.h>
|
||||
#include <logging.h>
|
||||
|
||||
#include <sstream>
|
||||
namespace gsl
|
||||
{
|
||||
namespace details
|
||||
{
|
||||
[[noreturn]] void terminate(nostd::source_location loc) noexcept
|
||||
{
|
||||
#if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND)
|
||||
(*gsl::details::get_terminate_handler())();
|
||||
#else
|
||||
std::ostringstream s;
|
||||
s << "ERROR: error detected null not_null detected at " << loc.file_name() << ":" << loc.line() << ":"
|
||||
<< loc.column() << ":" << loc.function_name()
|
||||
<< std::endl;
|
||||
std::cerr << s.str() << std::flush;
|
||||
LogPrintf("%s", s.str()); /* Continued */
|
||||
std::terminate();
|
||||
#endif // defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND)
|
||||
}
|
||||
|
||||
} // namespace details
|
||||
} // namespace gsl
|
||||
|
@ -18,10 +18,6 @@
|
||||
#define GSL_ASSERT_H
|
||||
|
||||
#include <source_location.h>
|
||||
#include <logging.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
//
|
||||
// Temporary until MSVC STL supports no-exceptions mode.
|
||||
// Currently terminate is a no-op in this mode, so we add termination behavior back
|
||||
@ -113,20 +109,7 @@ namespace gsl
|
||||
|
||||
#endif // defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND)
|
||||
|
||||
[[noreturn]] inline void terminate(nostd::source_location loc) noexcept
|
||||
{
|
||||
#if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND)
|
||||
(*gsl::details::get_terminate_handler())();
|
||||
#else
|
||||
std::ostringstream s;
|
||||
s << "ERROR: error detected null not_null detected at " << loc.file_name() << ":" << loc.line() << ":"
|
||||
<< loc.column() << ":" << loc.function_name()
|
||||
<< std::endl;
|
||||
std::cerr << s.str() << std::flush;
|
||||
LogPrintf("%s", s.str()); /* Continued */
|
||||
std::terminate();
|
||||
#endif // defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND)
|
||||
}
|
||||
[[noreturn]] void terminate(nostd::source_location loc) noexcept;
|
||||
|
||||
} // namespace details
|
||||
} // namespace gsl
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <consensus/params.h>
|
||||
#include <primitives/block.h>
|
||||
#include <saltedhasher.h>
|
||||
#include <streams.h>
|
||||
#include <sync.h>
|
||||
|
||||
#include <gsl/pointers.h>
|
||||
@ -21,6 +20,7 @@
|
||||
class BlockValidationState;
|
||||
class CChainState;
|
||||
class CConnman;
|
||||
class CDataStream;
|
||||
class CEvoDB;
|
||||
class CNode;
|
||||
class PeerManager;
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <primitives/block.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <saltedhasher.h>
|
||||
#include <streams.h>
|
||||
#include <sync.h>
|
||||
|
||||
#include <gsl/pointers.h>
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include <functional>
|
||||
#include <set>
|
||||
|
||||
#include <llmq/dkgsessionhandler.h>
|
||||
|
||||
class CDataStream;
|
||||
class CInv;
|
||||
class CScheduler;
|
||||
@ -21,6 +19,8 @@ class CScheduler;
|
||||
namespace llmq
|
||||
{
|
||||
|
||||
enum class QuorumPhase;
|
||||
|
||||
class CDKGDebugMemberStatus
|
||||
{
|
||||
public:
|
||||
|
@ -11,21 +11,33 @@
|
||||
#include <evo/deterministicmns.h>
|
||||
#include <evo/specialtx.h>
|
||||
|
||||
#include <masternode/node.h>
|
||||
#include <masternode/meta.h>
|
||||
#include <batchedlogger.h>
|
||||
#include <chainparams.h>
|
||||
#include <netmessagemaker.h>
|
||||
#include <univalue.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <cxxtimer.hpp>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <logging.h>
|
||||
#include <masternode/meta.h>
|
||||
#include <masternode/node.h>
|
||||
#include <netmessagemaker.h>
|
||||
#include <validation.h>
|
||||
#include <util/irange.h>
|
||||
#include <util/underlying.h>
|
||||
|
||||
#include <univalue.h>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
|
||||
namespace llmq
|
||||
{
|
||||
|
||||
class CDKGLogger : public CBatchedLogger
|
||||
{
|
||||
public:
|
||||
CDKGLogger(const CDKGSession& _quorumDkg, std::string_view _func) :
|
||||
CDKGLogger(_quorumDkg.params.name, _quorumDkg.quorumIndex, _quorumDkg.m_quorum_base_block_index->GetBlockHash(), _quorumDkg.m_quorum_base_block_index->nHeight, _quorumDkg.AreWeMember(), _func){};
|
||||
CDKGLogger(std::string_view _llmqTypeName, int _quorumIndex, const uint256& _quorumHash, int _height, bool _areWeMember, std::string_view _func) :
|
||||
CBatchedLogger(BCLog::LLMQ_DKG, strprintf("QuorumDKG(type=%s, quorumIndex=%d, height=%d, member=%d, func=%s)", _llmqTypeName, _quorumIndex, _height, _areWeMember, _func)){};
|
||||
};
|
||||
|
||||
static std::array<std::atomic<double>, ToUnderlying(DKGError::type::_COUNT)> simDkgErrorMap{};
|
||||
|
||||
void SetSimulatedDKGErrorRate(DKGError::type type, double rate)
|
||||
|
@ -5,8 +5,6 @@
|
||||
#ifndef BITCOIN_LLMQ_DKGSESSION_H
|
||||
#define BITCOIN_LLMQ_DKGSESSION_H
|
||||
|
||||
#include <batchedlogger.h>
|
||||
|
||||
#include <bls/bls.h>
|
||||
#include <bls/bls_ies.h>
|
||||
#include <bls/bls_worker.h>
|
||||
@ -365,15 +363,6 @@ private:
|
||||
[[nodiscard]] bool ShouldSimulateError(DKGError::type type) const;
|
||||
};
|
||||
|
||||
class CDKGLogger : public CBatchedLogger
|
||||
{
|
||||
public:
|
||||
CDKGLogger(const CDKGSession& _quorumDkg, std::string_view _func) :
|
||||
CDKGLogger(_quorumDkg.params.name, _quorumDkg.quorumIndex, _quorumDkg.m_quorum_base_block_index->GetBlockHash(), _quorumDkg.m_quorum_base_block_index->nHeight, _quorumDkg.AreWeMember(), _func){};
|
||||
CDKGLogger(std::string_view _llmqTypeName, int _quorumIndex, const uint256& _quorumHash, int _height, bool _areWeMember, std::string_view _func) :
|
||||
CBatchedLogger(BCLog::LLMQ_DKG, strprintf("QuorumDKG(type=%s, quorumIndex=%d, height=%d, member=%d, func=%s)", _llmqTypeName, _quorumIndex, _height, _areWeMember, _func)){};
|
||||
};
|
||||
|
||||
void SetSimulatedDKGErrorRate(DKGError::type type, double rate);
|
||||
double GetSimulatedErrorRate(DKGError::type type);
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <evo/deterministicmns.h>
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <dbwrapper.h>
|
||||
#include <net_processing.h>
|
||||
#include <spork.h>
|
||||
#include <util/irange.h>
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
class CBlockIndex;
|
||||
class CChainState;
|
||||
class CDBWrapper;
|
||||
class CDKGDebugManager;
|
||||
class CSporkManager;
|
||||
class PeerManager;
|
||||
|
@ -8,12 +8,11 @@
|
||||
#include <llmq/signing_shares.h>
|
||||
#include <llmq/commitment.h>
|
||||
|
||||
|
||||
#include <evo/mnhftx.h>
|
||||
#include <evo/specialtx.h>
|
||||
|
||||
#include <consensus/validation.h>
|
||||
#include <index/txindex.h> // g_txindex
|
||||
|
||||
#include <primitives/transaction.h>
|
||||
#include <spork.h>
|
||||
#include <txmempool.h>
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <bls/bls_batchverifier.h>
|
||||
#include <chainparams.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <dbwrapper.h>
|
||||
#include <index/txindex.h>
|
||||
#include <masternode/sync.h>
|
||||
#include <net_processing.h>
|
||||
@ -57,6 +58,13 @@ uint256 CInstantSendLock::GetRequestId() const
|
||||
////////////////
|
||||
|
||||
|
||||
CInstantSendDb::CInstantSendDb(bool unitTests, bool fWipe) :
|
||||
db(std::make_unique<CDBWrapper>(unitTests ? "" : (GetDataDir() / "llmq/isdb"), 32 << 20, unitTests, fWipe))
|
||||
{
|
||||
}
|
||||
|
||||
CInstantSendDb::~CInstantSendDb() = default;
|
||||
|
||||
void CInstantSendDb::Upgrade(const CTxMemPool& mempool)
|
||||
{
|
||||
LOCK2(cs_main, mempool.cs);
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include <chain.h>
|
||||
#include <coins.h>
|
||||
#include <dbwrapper.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <threadinterrupt.h>
|
||||
#include <txmempool.h>
|
||||
@ -22,6 +21,7 @@
|
||||
#include <unordered_set>
|
||||
|
||||
class CChainState;
|
||||
class CDBWrapper;
|
||||
class CMasternodeSync;
|
||||
class CSporkManager;
|
||||
class PeerManager;
|
||||
@ -121,9 +121,8 @@ private:
|
||||
|
||||
|
||||
public:
|
||||
explicit CInstantSendDb(bool unitTests, bool fWipe) :
|
||||
db(std::make_unique<CDBWrapper>(unitTests ? "" : (GetDataDir() / "llmq/isdb"), 32 << 20, unitTests, fWipe))
|
||||
{}
|
||||
explicit CInstantSendDb(bool unitTests, bool fWipe);
|
||||
~CInstantSendDb();
|
||||
|
||||
void Upgrade(const CTxMemPool& mempool) LOCKS_EXCLUDED(cs_db);
|
||||
|
||||
|
@ -12,10 +12,12 @@
|
||||
#include <bls/bls_batchverifier.h>
|
||||
#include <chainparams.h>
|
||||
#include <cxxtimer.hpp>
|
||||
#include <dbwrapper.h>
|
||||
#include <masternode/node.h>
|
||||
#include <net_processing.h>
|
||||
#include <netmessagemaker.h>
|
||||
#include <scheduler.h>
|
||||
#include <streams.h>
|
||||
#include <util/irange.h>
|
||||
#include <util/time.h>
|
||||
#include <util/underlying.h>
|
||||
@ -39,6 +41,14 @@ UniValue CRecoveredSig::ToJson() const
|
||||
}
|
||||
|
||||
|
||||
CRecoveredSigsDb::CRecoveredSigsDb(bool fMemory, bool fWipe) :
|
||||
db(std::make_unique<CDBWrapper>(fMemory ? "" : (GetDataDir() / "llmq/recsigdb"), 8 << 20, fMemory, fWipe))
|
||||
{
|
||||
MigrateRecoveredSigs();
|
||||
}
|
||||
|
||||
CRecoveredSigsDb::~CRecoveredSigsDb() = default;
|
||||
|
||||
void CRecoveredSigsDb::MigrateRecoveredSigs()
|
||||
{
|
||||
if (!db->IsEmpty()) return;
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <unordered_lru_cache.h>
|
||||
|
||||
#include <consensus/params.h>
|
||||
#include <dbwrapper.h>
|
||||
#include <random.h>
|
||||
#include <saltedhasher.h>
|
||||
#include <sync.h>
|
||||
@ -18,6 +17,9 @@
|
||||
#include <unordered_map>
|
||||
|
||||
class CConnman;
|
||||
class CDataStream;
|
||||
class CDBBatch;
|
||||
class CDBWrapper;
|
||||
class CInv;
|
||||
class CNode;
|
||||
class PeerManager;
|
||||
@ -115,11 +117,8 @@ private:
|
||||
mutable unordered_lru_cache<uint256, bool, StaticSaltedHasher, 30000> hasSigForHashCache GUARDED_BY(cs);
|
||||
|
||||
public:
|
||||
explicit CRecoveredSigsDb(bool fMemory, bool fWipe) :
|
||||
db(std::make_unique<CDBWrapper>(fMemory ? "" : (GetDataDir() / "llmq/recsigdb"), 8 << 20, fMemory, fWipe))
|
||||
{
|
||||
MigrateRecoveredSigs();
|
||||
}
|
||||
explicit CRecoveredSigsDb(bool fMemory, bool fWipe);
|
||||
~CRecoveredSigsDb();
|
||||
|
||||
bool HasRecoveredSig(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash) const;
|
||||
bool HasRecoveredSigForId(Consensus::LLMQType llmqType, const uint256& id) const;
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include <consensus/params.h>
|
||||
|
||||
#include <dbwrapper.h>
|
||||
#include <random.h>
|
||||
#include <set>
|
||||
#include <sync.h>
|
||||
|
@ -4,11 +4,14 @@
|
||||
|
||||
#include <bls/bls.h>
|
||||
#include <bls/bls_batchverifier.h>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <clientversion.h>
|
||||
#include <random.h>
|
||||
#include <streams.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <util/irange.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(bls_tests, BasicTestingSetup)
|
||||
|
||||
void FuncSign(const bool legacy_scheme)
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2014-2022 The Dash Core developers
|
||||
|
||||
#include <cachemap.h>
|
||||
|
||||
#include <streams.h>
|
||||
#include <test/util/setup_common.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2014-2022 The Dash Core developers
|
||||
|
||||
#include <cachemultimap.h>
|
||||
|
||||
#include <streams.h>
|
||||
#include <test/util/setup_common.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -6,7 +6,9 @@
|
||||
|
||||
#include <amount.h>
|
||||
#include <consensus/tx_check.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <evo/assetlocktx.h>
|
||||
#include <evo/specialtx.h>
|
||||
#include <policy/settings.h>
|
||||
#include <script/script.h>
|
||||
#include <script/signingprovider.h>
|
||||
|
@ -2,10 +2,10 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <test/util/setup_common.h>
|
||||
|
||||
#include <llmq/instantsend.h>
|
||||
|
||||
#include <test/util/setup_common.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(evo_instantsend_tests, BasicTestingSetup)
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <random.h>
|
||||
|
||||
#include <test/util/setup_common.h>
|
||||
#include <util/time.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
@ -12,9 +12,9 @@
|
||||
#include <node/context.h>
|
||||
#include <pubkey.h>
|
||||
#include <random.h>
|
||||
#include <txdb.h>
|
||||
#include <txmempool.h>
|
||||
#include <util/check.h>
|
||||
#include <util/system.h>
|
||||
#include <util/string.h>
|
||||
|
||||
#include <stdexcept>
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <util/threadnames.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <tinyformat.h>
|
||||
|
||||
#if (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__))
|
||||
#include <pthread.h>
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <fs.h>
|
||||
#include <logging.h>
|
||||
#include <sync.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/settings.h>
|
||||
#include <util/time.h>
|
||||
#include <amount.h>
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include <versionbits.h>
|
||||
#include <consensus/params.h>
|
||||
#include <gsl/pointers.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
@ -214,7 +213,7 @@ protected:
|
||||
return 0;
|
||||
}
|
||||
// ehfManager should be initialized before first usage of VersionBitsConditionChecker
|
||||
const auto ehfManagerPtr = gsl::make_not_null(AbstractEHFManager::getInstance());
|
||||
const auto ehfManagerPtr = AbstractEHFManager::getInstance();
|
||||
const auto signals = ehfManagerPtr->GetSignalsStage(pindexPrev);
|
||||
const auto it = signals.find(deployment.bit);
|
||||
if (it == signals.end()) {
|
||||
|
@ -6,6 +6,8 @@
|
||||
#define BITCOIN_VERSIONBITS_H
|
||||
|
||||
#include <chain.h>
|
||||
#include <gsl/pointers.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
/** What block version to use for new blocks (pre versionbits) */
|
||||
@ -100,7 +102,7 @@ public:
|
||||
* to get access to EHF data
|
||||
*/
|
||||
public:
|
||||
[[nodiscard]] static AbstractEHFManager* getInstance() {
|
||||
[[nodiscard]] static gsl::not_null<AbstractEHFManager*> getInstance() {
|
||||
return globalInstance;
|
||||
};
|
||||
|
||||
@ -116,7 +118,6 @@ public:
|
||||
|
||||
protected:
|
||||
static AbstractEHFManager* globalInstance;
|
||||
|
||||
};
|
||||
|
||||
#endif // BITCOIN_VERSIONBITS_H
|
||||
|
@ -101,8 +101,6 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
|
||||
"governance/object -> validationinterface -> governance/object"
|
||||
"governance/vote -> validation -> validationinterface -> governance/vote"
|
||||
"llmq/signing -> masternode/node -> validationinterface -> llmq/signing"
|
||||
"llmq/debug -> llmq/dkgsessionhandler -> llmq/debug"
|
||||
"llmq/debug -> llmq/dkgsessionhandler -> llmq/dkgsession -> llmq/debug"
|
||||
"llmq/utils -> validation -> llmq/utils"
|
||||
"evo/mnhftx -> validation -> evo/mnhftx"
|
||||
"evo/deterministicmns -> validation -> evo/deterministicmns"
|
||||
|
Loading…
Reference in New Issue
Block a user