Skip to content
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: 4 additions & 0 deletions doc/release-notes-6608.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
P2P Changes
-----------

* `cycleHash` field in `isdlock` message will now represent a DKG cycle starting block of the signing quorum instead of a DKG cycle starting block corresponding to the current chain height. While this is fully backwards compatible with older versions of Dash Core, other implementations might not be expecting this, so the P2P protocol version was bumped to 70237.
25 changes: 15 additions & 10 deletions src/llmq/instantsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,21 +672,26 @@ void CInstantSendManager::TrySignInstantSendLock(const CTransaction& tx)
islock.inputs.emplace_back(in.prevout);
}

{
const auto &llmq_params_opt = Params().GetLLMQ(llmqType);
assert(llmq_params_opt);
LOCK(cs_main);
const auto dkgInterval = llmq_params_opt->dkgInterval;
const auto quorumHeight = m_chainstate.m_chain.Height() - (m_chainstate.m_chain.Height() % dkgInterval);
islock.cycleHash = m_chainstate.m_chain[quorumHeight]->GetBlockHash();
}

auto id = islock.GetRequestId();

if (sigman.HasRecoveredSigForId(llmqType, id)) {
return;
}

const auto& llmq_params_opt = Params().GetLLMQ(llmqType);
assert(llmq_params_opt);
const auto quorum = SelectQuorumForSigning(llmq_params_opt.value(), m_chainstate.m_chain, qman, id);

if (!quorum) {
LogPrint(BCLog::INSTANTSEND, "CInstantSendManager::%s -- failed to select quorum. islock id=%s, txid=%s\n",
__func__, id.ToString(), tx.GetHash().ToString());
return;
}

const int cycle_height = quorum->m_quorum_base_block_index->nHeight -
quorum->m_quorum_base_block_index->nHeight % llmq_params_opt->dkgInterval;
islock.cycleHash = quorum->m_quorum_base_block_index->GetAncestor(cycle_height)->GetBlockHash();

{
LOCK(cs_creating);
auto e = creatingInstantSendLocks.emplace(id, std::move(islock));
Expand All @@ -696,7 +701,7 @@ void CInstantSendManager::TrySignInstantSendLock(const CTransaction& tx)
txToCreatingInstantSendLocks.emplace(tx.GetHash(), &e.first->second);
}

sigman.AsyncSignIfMember(llmqType, shareman, id, tx.GetHash());
sigman.AsyncSignIfMember(llmqType, shareman, id, tx.GetHash(), quorum->m_quorum_base_block_index->GetBlockHash());
}

void CInstantSendManager::HandleNewInstantSendLockRecoveredSig(const llmq::CRecoveredSig& recoveredSig)
Expand Down
7 changes: 5 additions & 2 deletions src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/


static const int PROTOCOL_VERSION = 70236;
static const int PROTOCOL_VERSION = 70237;

//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
Expand All @@ -20,7 +20,7 @@ static const int INIT_PROTO_VERSION = 209;
static const int MIN_PEER_PROTO_VERSION = 70216;

//! minimum proto version of masternode to accept in DKGs
static const int MIN_MASTERNODE_PROTO_VERSION = 70235;
static const int MIN_MASTERNODE_PROTO_VERSION = 70237;

//! protocol version is included in MNAUTH starting with this version
static const int MNAUTH_NODE_VER_VERSION = 70218;
Expand Down Expand Up @@ -64,6 +64,9 @@ static const int INCREASE_MAX_HEADERS2_VERSION = 70235;
//! Behavior of QRINFO is changed in this protocol version
static const int EFFICIENT_QRINFO_VERSION = 70236;

//! cycleHash in isdlock message switched to using quorum's base block in this version
static const int ISDLOCK_CYCLEHASH_UPDATE_VERSION = 70237;

// Make sure that none of the values above collide with `ADDRV2_FORMAT`.

#endif // BITCOIN_VERSION_H
4 changes: 2 additions & 2 deletions test/functional/test_framework/p2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@
# The minimum P2P version that this test framework supports
MIN_P2P_VERSION_SUPPORTED = 60001
# The P2P version that this test framework implements and sends in its `version` message
# Version 70235 increased max header count for HEADERS2 message from 2000 to 8000
P2P_VERSION = 70236
# Version 70237 switched cycleHash in isdlock message to using quorum's base block
P2P_VERSION = 70237
# The services that this test framework offers in its `version` message
P2P_SERVICES = NODE_NETWORK | NODE_HEADERS_COMPRESSED
# The P2P user agent string that this test framework sends in its `version` message
Expand Down
Loading