Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: a bunch of trivial-ish headers improvements #6376

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/evo/assetlocktx.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#define BITCOIN_EVO_ASSETLOCKTX_H

#include <bls/bls_ies.h>
#include <primitives/transaction.h>
#include <consensus/amount.h>
#include <gsl/pointers.h>

#include <primitives/transaction.h>
#include <serialize.h>
#include <univalue.h>

Expand Down
15 changes: 5 additions & 10 deletions src/evo/cbtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <deploymentstatus.h>
#include <validation.h>


bool CheckCbTx(const CTransaction& tx, const CBlockIndex* pindexPrev, TxValidationState& state)
{
if (tx.nType != TRANSACTION_COINBASE) {
Expand Down Expand Up @@ -448,7 +449,7 @@ std::string CCbTx::ToString() const
creditPoolBalance / COIN, creditPoolBalance % COIN);
}

std::optional<CCbTx> GetCoinbaseTx(const CBlockIndex* pindex)
std::optional<std::pair<CBLSSignature, uint32_t>> GetNonNullCoinbaseChainlock(const CBlockIndex* pindex)
UdjinM6 marked this conversation as resolved.
Show resolved Hide resolved
{
if (pindex == nullptr) {
return std::nullopt;
Expand All @@ -464,20 +465,14 @@ std::optional<CCbTx> GetCoinbaseTx(const CBlockIndex* pindex)
return std::nullopt;
}

CTransactionRef cbTx = block.vtx[0];
return GetTxPayload<CCbTx>(*cbTx);
}

std::optional<std::pair<CBLSSignature, uint32_t>> GetNonNullCoinbaseChainlock(const CBlockIndex* pindex)
{
auto opt_cbtx = GetCoinbaseTx(pindex);
const CTransactionRef cbTx = block.vtx[0];
const auto opt_cbtx = GetTxPayload<CCbTx>(*cbTx);

if (!opt_cbtx.has_value()) {
return std::nullopt;
}

CCbTx& cbtx = opt_cbtx.value();

const CCbTx& cbtx = opt_cbtx.value();
if (cbtx.nVersion < CCbTx::Version::CLSIG_AND_BALANCE) {
return std::nullopt;
}
Expand Down
1 change: 0 additions & 1 deletion src/evo/cbtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ bool CheckCbTxBestChainlock(const CBlock& block, const CBlockIndex* pindexPrev,
bool CalcCbTxBestChainlock(const llmq::CChainLocksHandler& chainlock_handler, const CBlockIndex* pindexPrev,
uint32_t& bestCLHeightDiff, CBLSSignature& bestCLSignature);

std::optional<CCbTx> GetCoinbaseTx(const CBlockIndex* pindex);
std::optional<std::pair<CBLSSignature, uint32_t>> GetNonNullCoinbaseChainlock(const CBlockIndex* pindex);

#endif // BITCOIN_EVO_CBTX_H
8 changes: 4 additions & 4 deletions src/evo/creditpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
#ifndef BITCOIN_EVO_CREDITPOOL_H
#define BITCOIN_EVO_CREDITPOOL_H

#include <coins.h>

#include <evo/assetlocktx.h>

#include <consensus/amount.h>
#include <saltedhasher.h>
#include <serialize.h>
#include <sync.h>
#include <threadsafety.h>
#include <unordered_lru_cache.h>
#include <util/ranges_set.h>

#include <evo/assetlocktx.h>

#include <optional>
#include <unordered_set>

class BlockManager;
class CBlock;
class CBlockIndex;
class BlockValidationState;
class CEvoDB;
Expand Down
1 change: 1 addition & 0 deletions src/evo/deterministicmns.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
class CBlock;
class CBlockIndex;
class CChainState;
class CCoinsViewCache;
class CConnman;
class CEvoDB;
class TxValidationState;
Expand Down
6 changes: 3 additions & 3 deletions src/evo/dmnstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
#ifndef BITCOIN_EVO_DMNSTATE_H
#define BITCOIN_EVO_DMNSTATE_H

#include <crypto/common.h>
#include <bls/bls.h>
#include <pubkey.h>
#include <crypto/sha256.h>
#include <evo/providertx.h>
#include <netaddress.h>
#include <pubkey.h>
#include <script/script.h>
#include <evo/providertx.h>

#include <memory>
#include <utility>
Expand Down
4 changes: 0 additions & 4 deletions src/evo/mnauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ class CBlockIndex;
class CChain;
class CConnman;
class CDataStream;
class CDeterministicMN;
class CDeterministicMNList;
class CDeterministicMNListDiff;
class CDeterministicMNManager;
class CMasternodeMetaMan;
class CMasternodeSync;
class CNode;

class UniValue;

enum ServiceFlags : uint64_t;

/**
Expand Down
3 changes: 1 addition & 2 deletions src/evo/mnhftx.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,20 @@

#include <bls/bls.h>
#include <gsl/pointers.h>
#include <primitives/transaction.h>
#include <sync.h>
#include <threadsafety.h>
#include <univalue.h>

#include <optional>
#include <saltedhasher.h>
#include <unordered_map>
#include <unordered_lru_cache.h>
#include <versionbits.h>

class BlockValidationState;
class CBlock;
class CBlockIndex;
class CEvoDB;
class CTransaction;
class ChainstateManager;
class TxValidationState;
namespace llmq {
Expand Down
2 changes: 0 additions & 2 deletions src/evo/providertx.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include <univalue.h>
#include <util/underlying.h>

class CBlockIndex;
class CCoinsViewCache;
class TxValidationState;

class CProRegTx
Expand Down
8 changes: 6 additions & 2 deletions src/evo/simplifiedmns.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@
#define BITCOIN_EVO_SIMPLIFIEDMNS_H

#include <bls/bls.h>
#include <evo/deterministicmns.h>
#include <evo/dmn_types.h>
#include <merkleblock.h>
#include <netaddress.h>
#include <pubkey.h>
#include <sync.h>
#include <threadsafety.h>

class UniValue;
class CBlockIndex;
class CDeterministicMNList;
class CDeterministicMN;
class CDeterministicMNList;
class CDeterministicMNManager;
class ChainstateManager;

extern RecursiveMutex cs_main;

namespace llmq {
class CFinalCommitment;
class CQuorumBlockProcessor;
Expand Down
1 change: 0 additions & 1 deletion src/evo/specialtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <uint256.h>
#include <version.h>

#include <string_view>
#include <optional>
#include <vector>

Expand Down
3 changes: 2 additions & 1 deletion src/evo/specialtxman.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef BITCOIN_EVO_SPECIALTXMAN_H
#define BITCOIN_EVO_SPECIALTXMAN_H

#include <primitives/transaction.h>
#include <consensus/amount.h>
#include <sync.h>
#include <threadsafety.h>

Expand All @@ -17,6 +17,7 @@ class CBlockIndex;
class CCoinsViewCache;
class CCreditPoolManager;
class CDeterministicMNManager;
class CTransaction;
class ChainstateManager;
class CMNHFManager;
class TxValidationState;
Expand Down
7 changes: 3 additions & 4 deletions src/llmq/blockprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

#include <unordered_lru_cache.h>

#include <chain.h>
#include <consensus/params.h>
#include <primitives/block.h>
#include <llmq/params.h>
#include <protocol.h>
#include <saltedhasher.h>
#include <sync.h>
Expand All @@ -19,9 +17,10 @@
#include <optional>

class BlockValidationState;
class CBlock;
class CBlockIndex;
class CChain;
class CChainState;
class CConnman;
class CDataStream;
class CDeterministicMNManager;
class CEvoDB;
Expand Down
9 changes: 4 additions & 5 deletions src/llmq/chainlocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@

#include <llmq/clsig.h>

#include <crypto/common.h>
#include <crypto/common.h> // For ReadLE64
#include <llmq/signing.h>
#include <net.h>
#include <net.h> // For NodeId
#include <net_types.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <saltedhasher.h>
#include <sync.h>
Expand All @@ -21,10 +20,10 @@
#include <atomic>
#include <map>
#include <unordered_map>
#include <unordered_set>

class CChainState;
class CBlock;
class CBlockIndex;
class CChainState;
class CMasternodeSync;
class CScheduler;
class CSporkManager;
Expand Down
8 changes: 6 additions & 2 deletions src/llmq/commitment.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@
#define BITCOIN_LLMQ_COMMITMENT_H

#include <bls/bls.h>
#include <consensus/params.h>
#include <llmq/params.h>
#include <primitives/transaction.h>
#include <util/irange.h>
#include <util/strencodings.h>
#include <util/underlying.h>

#include <gsl/pointers.h>

#include <univalue.h>

#include <limits>
#include <memory>
#include <string>
#include <vector>

class CBlockIndex;
class CDeterministicMNManager;
class ChainstateManager;
Expand Down
1 change: 0 additions & 1 deletion src/llmq/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class CBLSWorker;
class CConnman;
class ChainstateManager;
class CDeterministicMNManager;
class CDBWrapper;
class CEvoDB;
class CMasternodeMetaMan;
class CMasternodeSync;
Expand Down
1 change: 0 additions & 1 deletion src/llmq/dkgsession.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class CConnman;
class CDeterministicMN;
class CMasternodeMetaMan;
class CSporkManager;
class UniValue;

using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;

Expand Down
13 changes: 10 additions & 3 deletions src/llmq/dkgsessionhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,28 @@
#ifndef BITCOIN_LLMQ_DKGSESSIONHANDLER_H
#define BITCOIN_LLMQ_DKGSESSIONHANDLER_H

#include <ctpl_stl.h>
#include <net.h>
#include <net.h> // for NodeId

#include <gsl/pointers.h>

#include <atomic>
#include <list>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <thread>
#include <vector>

class CActiveMasternodeManager;
class CBlockIndex;
class CBLSWorker;
class CBlockIndex;
class CChainState;
class CConnman;
class CDeterministicMNManager;
class CMasternodeMetaMan;
class CNode;
class CSporkManager;
class PeerManager;

Expand Down
10 changes: 5 additions & 5 deletions src/llmq/dkgsessionmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
#include <util/underlying.h>
#include <validation.h>

static bool IsQuorumDKGEnabled(const CSporkManager& sporkman)
{
return sporkman.IsSporkActive(SPORK_17_QUORUM_DKG_ENABLED);
}

namespace llmq
{
static const std::string DB_VVEC = "qdkg_V";
Expand Down Expand Up @@ -515,9 +520,4 @@ void CDKGSessionManager::CleanupOldContributions() const
}
}

bool IsQuorumDKGEnabled(const CSporkManager& sporkman)
{
return sporkman.IsSporkActive(SPORK_17_QUORUM_DKG_ENABLED);
}

} // namespace llmq
2 changes: 0 additions & 2 deletions src/llmq/dkgsessionmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ class CDKGSessionManager
void MigrateDKG();
void CleanupCache() const;
};

bool IsQuorumDKGEnabled(const CSporkManager& sporkman);
} // namespace llmq

#endif // BITCOIN_LLMQ_DKGSESSIONMGR_H
8 changes: 4 additions & 4 deletions src/llmq/instantsend.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
#define BITCOIN_LLMQ_INSTANTSEND_H

#include <llmq/signing.h>
#include <unordered_lru_cache.h>

#include <chain.h>
#include <coins.h>
#include <consensus/params.h>
#include <net_types.h>
#include <primitives/transaction.h>
#include <threadinterrupt.h>
#include <txmempool.h>
#include <unordered_lru_cache.h>

#include <gsl/pointers.h>

#include <atomic>
#include <unordered_map>
#include <unordered_set>

class CBlockIndex;
class CChainState;
class CDBWrapper;
class CMasternodeSync;
Expand Down Expand Up @@ -365,7 +365,7 @@ class CInstantSendManager : public CRecoveredSigsListener
bool IsInstantSendMempoolSigningEnabled() const;
bool RejectConflictingBlocks() const;
};

// TODO: split CInstantSendManager and CInstantSendLock to 2 files
extern std::unique_ptr<CInstantSendManager> quorumInstantSendManager;

} // namespace llmq
Expand Down
Loading
Loading