dash/src/evo/cbtx.h
Kittywhiskers Van Gogh a35245653c
refactor: pass references to objects instead of using global definitions (#4988)
* fix: move chain activation logic downward to succeed LLMQ initialization

* fix: change order of initialization to reflect dependency

* llmq: pass all global pointers invoked as CDSNotificationInterface arguments

* llmq: pass reference to quorumDKGDebugManager instead of invoking global

* llmq: pass reference to quorumBlockProcessor instead of invoking global

* llmq: pass reference to quorumDKGSessionManager instead of invoking global

* llmq: pass reference to quorumManager instead of invoking global

Co-authored-by: "UdjinM6 <UdjinM6@users.noreply.github.com>"

* llmq: pass reference to quorumSigSharesManager within CSigningManager and networking

* llmq: pass reference to quorumSigSharesManager instead of invoking global

* llmq: pass reference to chainLocksHandler instead of querying global

* llmq: pass reference to quorumInstantSendManager instead of querying global

* trivial: accept argument as const where possible

* style: remove an unneeded const_cast and instead pass by const reference

* style: use const where possible

Co-authored-by: pasta <pasta@dashboost.org>
2022-09-22 15:14:48 +04:00

63 lines
2.0 KiB
C++

// Copyright (c) 2017-2022 The Dash Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_EVO_CBTX_H
#define BITCOIN_EVO_CBTX_H
#include <primitives/transaction.h>
#include <univalue.h>
class CBlock;
class CBlockIndex;
class CCoinsViewCache;
class CValidationState;
namespace llmq {
class CQuorumBlockProcessor;
}// namespace llmq
// coinbase transaction
class CCbTx
{
public:
static constexpr auto SPECIALTX_TYPE = TRANSACTION_COINBASE;
static constexpr uint16_t CURRENT_VERSION = 2;
uint16_t nVersion{CURRENT_VERSION};
int32_t nHeight{0};
uint256 merkleRootMNList;
uint256 merkleRootQuorums;
SERIALIZE_METHODS(CCbTx, obj)
{
READWRITE(obj.nVersion, obj.nHeight, obj.merkleRootMNList);
if (obj.nVersion >= 2) {
READWRITE(obj.merkleRootQuorums);
}
}
std::string ToString() const;
void ToJson(UniValue& obj) const
{
obj.clear();
obj.setObject();
obj.pushKV("version", (int)nVersion);
obj.pushKV("height", nHeight);
obj.pushKV("merkleRootMNList", merkleRootMNList.ToString());
if (nVersion >= 2) {
obj.pushKV("merkleRootQuorums", merkleRootQuorums.ToString());
}
}
};
bool CheckCbTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CValidationState& state);
bool CheckCbTxMerkleRoots(const CBlock& block, const CBlockIndex* pindex, const llmq::CQuorumBlockProcessor& quorum_block_processor, CValidationState& state, const CCoinsViewCache& view);
bool CalcCbTxMerkleRootMNList(const CBlock& block, const CBlockIndex* pindexPrev, uint256& merkleRootRet, CValidationState& state, const CCoinsViewCache& view);
bool CalcCbTxMerkleRootQuorums(const CBlock& block, const CBlockIndex* pindexPrev, const llmq::CQuorumBlockProcessor& quorum_block_processor, uint256& merkleRootRet, CValidationState& state);
#endif // BITCOIN_EVO_CBTX_H