From 83328b70e94742268ca584639b900c984c7fe966 Mon Sep 17 00:00:00 2001 From: BLOCXTECH <134414477+BLOCXTECH@users.noreply.github.com> Date: Sat, 26 Oct 2024 16:56:29 +0530 Subject: [PATCH] v4.0.3 --- configure.ac | 2 +- src/llmq/blockprocessor.cpp | 18 ++++++++++++++++++ src/llmq/blockprocessor.h | 2 +- src/spork.h | 4 +++- src/validation.cpp | 5 +++++ src/validation.h | 1 + 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 2a340da..91ede1d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.69]) define(_CLIENT_VERSION_MAJOR, 4) define(_CLIENT_VERSION_MINOR, 0) -define(_CLIENT_VERSION_BUILD, 2) +define(_CLIENT_VERSION_BUILD, 3) define(_CLIENT_VERSION_RC, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2023) diff --git a/src/llmq/blockprocessor.cpp b/src/llmq/blockprocessor.cpp index 25a354a..dbd15fd 100644 --- a/src/llmq/blockprocessor.cpp +++ b/src/llmq/blockprocessor.cpp @@ -809,6 +809,24 @@ bool CQuorumBlockProcessor::GetMineableCommitmentsTx(const Consensus::LLMQParams CFinalCommitmentTxPayload qc; qc.nHeight = nHeight; qc.commitment = f; + if (IsQuorumAdjustmentSporkENABLED()) { + auto paramTypeOpt = llmq::GetLLMQParams(f.llmqType); + if (!paramTypeOpt.has_value()) { + continue; + } + int n_Height = int(nHeight / paramTypeOpt->dkgInterval) * paramTypeOpt->dkgInterval; + + if (n_Height % (paramTypeOpt->dkgInterval * 2) != 0 && + f.llmqType != Consensus::LLMQType::LLMQ_400_60 + ) { + qc.commitment.signers = std::vector(paramTypeOpt->size, false); + qc.commitment.validMembers = std::vector(paramTypeOpt->size, false); + qc.commitment.quorumPublicKey = CBLSPublicKey(); + qc.commitment.quorumVvecHash.SetNull(); + qc.commitment.quorumSig.Reset(); + qc.commitment.membersSig.Reset(); + } + } CMutableTransaction tx; tx.nVersion = 3; tx.nType = TRANSACTION_QUORUM_COMMITMENT; diff --git a/src/llmq/blockprocessor.h b/src/llmq/blockprocessor.h index 529d24e..737327b 100644 --- a/src/llmq/blockprocessor.h +++ b/src/llmq/blockprocessor.h @@ -66,12 +66,12 @@ class CQuorumBlockProcessor std::vector GetMinedCommitmentsIndexedUntilBlock(Consensus::LLMQType llmqType, const CBlockIndex* pindex, size_t maxCount) const; std::vector> GetLastMinedCommitmentsPerQuorumIndexUntilBlock(Consensus::LLMQType llmqType, const CBlockIndex* pindex, size_t cycle) const; std::optional GetLastMinedCommitmentsByQuorumIndexUntilBlock(Consensus::LLMQType llmqType, const CBlockIndex* pindex, int quorumIndex, size_t cycle) const; + static uint256 GetQuorumBlockHash(const Consensus::LLMQParams& llmqParams, int nHeight, int quorumIndex) EXCLUSIVE_LOCKS_REQUIRED(cs_main); private: static bool GetCommitmentsFromBlock(const CBlock& block, const CBlockIndex* pindex, std::multimap& ret, CValidationState& state) EXCLUSIVE_LOCKS_REQUIRED(cs_main); bool ProcessCommitment(int nHeight, const uint256& blockHash, const CFinalCommitment& qc, CValidationState& state, bool fJustCheck, bool fBLSChecks) EXCLUSIVE_LOCKS_REQUIRED(cs_main); static bool IsMiningPhase(const Consensus::LLMQParams& llmqParams, int nHeight) EXCLUSIVE_LOCKS_REQUIRED(cs_main); size_t GetNumCommitmentsRequired(const Consensus::LLMQParams& llmqParams, int nHeight) const EXCLUSIVE_LOCKS_REQUIRED(cs_main); - static uint256 GetQuorumBlockHash(const Consensus::LLMQParams& llmqParams, int nHeight, int quorumIndex) EXCLUSIVE_LOCKS_REQUIRED(cs_main); }; extern std::unique_ptr quorumBlockProcessor; diff --git a/src/spork.h b/src/spork.h index 39ccc93..fb93a1c 100644 --- a/src/spork.h +++ b/src/spork.h @@ -39,6 +39,7 @@ enum SporkId : int32_t { SPORK_21_QUORUM_ALL_CONNECTED = 10020, SPORK_22_UPDATE_LITEMN = 10021, SPORK_23_QUORUM_POSE = 10022, + SPORK_24_QUORUM_ADJUSTMENT = 10023, SPORK_INVALID = -1, }; @@ -64,7 +65,7 @@ struct CSporkDef }; #define MAKE_SPORK_DEF(name, defaultValue) CSporkDef{name, defaultValue, #name} -[[maybe_unused]] static constexpr std::array sporkDefs = { +[[maybe_unused]] static constexpr std::array sporkDefs = { MAKE_SPORK_DEF(SPORK_2_INSTANTSEND_ENABLED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_3_INSTANTSEND_BLOCK_FILTERING, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_9_SUPERBLOCKS_ENABLED, 4070908800ULL), // OFF @@ -73,6 +74,7 @@ struct CSporkDef MAKE_SPORK_DEF(SPORK_21_QUORUM_ALL_CONNECTED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_22_UPDATE_LITEMN, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_23_QUORUM_POSE, 4070908800ULL), // OFF + MAKE_SPORK_DEF(SPORK_24_QUORUM_ADJUSTMENT, 4070908800ULL), // OFF }; #undef MAKE_SPORK_DEF extern std::unique_ptr sporkManager; diff --git a/src/validation.cpp b/src/validation.cpp index 5c932f7..caa1580 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2575,6 +2575,11 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl return true; } +bool IsQuorumAdjustmentSporkENABLED() +{ + return sporkManager->IsSporkActive(SPORK_24_QUORUM_ADJUSTMENT); +} + CoinsCacheSizeState CChainState::GetCoinsCacheSizeState(const CTxMemPool* tx_pool) { return this->GetCoinsCacheSizeState( diff --git a/src/validation.h b/src/validation.h index 4281a1e..fb1ac6b 100644 --- a/src/validation.h +++ b/src/validation.h @@ -277,6 +277,7 @@ bool TestLockPointValidity(const LockPoints* lp) EXCLUSIVE_LOCKS_REQUIRED(cs_mai * See consensus/consensus.h for flag definitions. */ bool CheckSequenceLocks(const CTxMemPool& pool, const CTransaction& tx, int flags, LockPoints* lp = nullptr, bool useExistingLockPoints = false) EXCLUSIVE_LOCKS_REQUIRED(cs_main); +bool IsQuorumAdjustmentSporkENABLED(); /** * Closure representing one script verification