Skip to content

Commit

Permalink
v4.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
BLOCXTECH committed Oct 26, 2024
1 parent 7657d89 commit 83328b7
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
18 changes: 18 additions & 0 deletions src/llmq/blockprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>(paramTypeOpt->size, false);
qc.commitment.validMembers = std::vector<bool>(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;
Expand Down
2 changes: 1 addition & 1 deletion src/llmq/blockprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ class CQuorumBlockProcessor
std::vector<const CBlockIndex*> GetMinedCommitmentsIndexedUntilBlock(Consensus::LLMQType llmqType, const CBlockIndex* pindex, size_t maxCount) const;
std::vector<std::pair<int, const CBlockIndex*>> GetLastMinedCommitmentsPerQuorumIndexUntilBlock(Consensus::LLMQType llmqType, const CBlockIndex* pindex, size_t cycle) const;
std::optional<const CBlockIndex*> 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<Consensus::LLMQType, CFinalCommitment>& 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<CQuorumBlockProcessor> quorumBlockProcessor;
Expand Down
4 changes: 3 additions & 1 deletion src/spork.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -64,7 +65,7 @@ struct CSporkDef
};

#define MAKE_SPORK_DEF(name, defaultValue) CSporkDef{name, defaultValue, #name}
[[maybe_unused]] static constexpr std::array<CSporkDef, 8> sporkDefs = {
[[maybe_unused]] static constexpr std::array<CSporkDef, 9> 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
Expand All @@ -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<CSporkManager> sporkManager;
Expand Down
5 changes: 5 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions src/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 83328b7

Please sign in to comment.