From 7c05e5651e3ae3b3a3c2342c645beed4f4026fc3 Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 17:45:21 -0500 Subject: [PATCH] refactor: drop redundant CSigningManager argument from AsyncSignIfMember CSigSharesManager has held a CSigningManager& member since a35245653c15, and there is exactly one CSigningManager in a node (llmq_ctx->sigman). ActiveContext hands that same reference to CSigSharesManager and to every caller, so all five call sites already passed the object the member points at. The parameter was added by 0052fcaa59bd, which moved AsyncSignIfMember off CSigningManager onto CSigSharesManager. Before the move the method took the opposite manager (CSigSharesManager& shareman); afterwards that argument became 'this' and a sigman argument was added to reach back for the db. The member was already declared 34 lines above the new signature in the same header. The parameter shadowed that member, so the single sigman.GetDb() in the body silently used the argument while the surrounding code reaches for qman and m_chainman as members. Dropping the parameter leaves the body unchanged; sigman now resolves to the member. No behavior change. --- src/chainlock/signing.cpp | 2 +- src/instantsend/signing.cpp | 4 ++-- src/llmq/ehf_signals.cpp | 2 +- src/llmq/signing_shares.cpp | 2 +- src/llmq/signing_shares.h | 2 +- src/rpc/quorums.cpp | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/chainlock/signing.cpp b/src/chainlock/signing.cpp index b9e2f04c5fb2..3fe4f4e6e413 100644 --- a/src/chainlock/signing.cpp +++ b/src/chainlock/signing.cpp @@ -174,7 +174,7 @@ void ChainLockSigner::TrySignChainTip() lastSignedMsgHash = msgHash; } - m_shareman.AsyncSignIfMember(Params().GetConsensus().llmqTypeChainLocks, m_sigman, requestId, msgHash); + m_shareman.AsyncSignIfMember(Params().GetConsensus().llmqTypeChainLocks, requestId, msgHash); } void ChainLockSigner::BlockDisconnected(const std::shared_ptr& block, const CBlockIndex* pindex) diff --git a/src/instantsend/signing.cpp b/src/instantsend/signing.cpp index 5ff589adb757..73a42cd099c3 100644 --- a/src/instantsend/signing.cpp +++ b/src/instantsend/signing.cpp @@ -353,7 +353,7 @@ bool InstantSendSigner::TrySignInputLocks(const CTransaction& tx, bool fRetroact WITH_LOCK(cs_input_requests, inputRequestIds.emplace(id)); LogPrint(BCLog::INSTANTSEND, "%s -- txid=%s: trying to vote on input %s with id %s. fRetroactive=%d\n", __func__, tx.GetHash().ToString(), in.prevout.ToStringShort(), id.ToString(), fRetroactive); - if (m_shareman.AsyncSignIfMember(llmqType, m_sigman, id, tx.GetHash(), {}, fRetroactive)) { + if (m_shareman.AsyncSignIfMember(llmqType, id, tx.GetHash(), {}, fRetroactive)) { LogPrint(BCLog::INSTANTSEND, "%s -- txid=%s: voted on input %s with id %s\n", __func__, tx.GetHash().ToString(), in.prevout.ToStringShort(), id.ToString()); } @@ -412,6 +412,6 @@ void InstantSendSigner::TrySignInstantSendLock(const CTransaction& tx) txToCreatingInstantSendLocks.emplace(tx.GetHash(), &e.first->second); } - m_shareman.AsyncSignIfMember(llmqType, m_sigman, id, tx.GetHash(), quorum->m_quorum_base_block_index->GetBlockHash()); + m_shareman.AsyncSignIfMember(llmqType, id, tx.GetHash(), quorum->m_quorum_base_block_index->GetBlockHash()); } } // namespace instantsend diff --git a/src/llmq/ehf_signals.cpp b/src/llmq/ehf_signals.cpp index be878235393c..a5e26f80f0fd 100644 --- a/src/llmq/ehf_signals.cpp +++ b/src/llmq/ehf_signals.cpp @@ -79,7 +79,7 @@ void CEHFSignalsHandler::trySignEHFSignal(int bit, const CBlockIndex* const pind const uint256 msgHash = mnhfPayload.PrepareTx().GetHash(); WITH_LOCK(cs, ids.insert(requestId)); - shareman.AsyncSignIfMember(llmqType, sigman, requestId, msgHash, quorum->qc->quorumHash, false, true); + shareman.AsyncSignIfMember(llmqType, requestId, msgHash, quorum->qc->quorumHash, false, true); } RecoveredSigResult CEHFSignalsHandler::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) diff --git a/src/llmq/signing_shares.cpp b/src/llmq/signing_shares.cpp index bec02769c7ab..c09470239ff5 100644 --- a/src/llmq/signing_shares.cpp +++ b/src/llmq/signing_shares.cpp @@ -761,7 +761,7 @@ CDeterministicMNCPtr CSigSharesManager::SelectMemberForRecovery(const CQuorum& q return v[attempt % v.size()].second; } -bool CSigSharesManager::AsyncSignIfMember(Consensus::LLMQType llmqType, CSigningManager& sigman, const uint256& id, +bool CSigSharesManager::AsyncSignIfMember(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash, const uint256& quorumHash, bool allowReSign, bool allowDiffMsgHashSigning) { diff --git a/src/llmq/signing_shares.h b/src/llmq/signing_shares.h index ea21915a2c82..40d2dc620186 100644 --- a/src/llmq/signing_shares.h +++ b/src/llmq/signing_shares.h @@ -508,7 +508,7 @@ class CSigSharesManager : public llmq::CRecoveredSigsListener static CDeterministicMNCPtr SelectMemberForRecovery(const CQuorum& quorum, const uint256& id, int attempt); - bool AsyncSignIfMember(Consensus::LLMQType llmqType, CSigningManager& sigman, const uint256& id, + bool AsyncSignIfMember(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash, const uint256& quorumHash = uint256(), bool allowReSign = false, bool allowDiffMsgHashSigning = false) EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingSigns, !cs); private: diff --git a/src/rpc/quorums.cpp b/src/rpc/quorums.cpp index 3b09ad18ed33..4ec10d621dee 100644 --- a/src/rpc/quorums.cpp +++ b/src/rpc/quorums.cpp @@ -530,7 +530,7 @@ static UniValue quorum_sign_helper(const JSONRPCRequest& request, Consensus::LLM fSubmit = ParseBoolV(request.params[3], "submit"); } if (fSubmit) { - return CHECK_NONFATAL(node.active_ctx)->shareman->AsyncSignIfMember(llmqType, *llmq_ctx.sigman, id, msgHash, quorumHash); + return CHECK_NONFATAL(node.active_ctx)->shareman->AsyncSignIfMember(llmqType, id, msgHash, quorumHash); } else { const auto pQuorum = [&]() { if (quorumHash.IsNull()) {