Line data Source code
1 : // Copyright (c) 2021-2025 The Dash Core developers 2 : // Distributed under the MIT software license, see the accompanying 3 : // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 : 5 : #include <chainlock/clsig.h> 6 : 7 : #include <chainparams.h> 8 : #include <chainlock/chainlock.h> 9 : #include <llmq/quorumsman.h> 10 : 11 : #include <string_view> 12 : 13 : namespace chainlock { 14 : static constexpr std::string_view CLSIG_REQUESTID_PREFIX{"clsig"}; 15 : 16 57533 : uint256 GenSigRequestId(const int32_t nHeight) 17 : { 18 57533 : return ::SerializeHash(std::make_pair(CLSIG_REQUESTID_PREFIX, nHeight)); 19 : } 20 : 21 18129 : llmq::VerifyRecSigStatus VerifyChainLock(const Consensus::Params& params, const CChain& chain, 22 : const llmq::CQuorumManager& qman, const chainlock::ChainLockSig& clsig) 23 : { 24 18129 : const auto llmqType = params.llmqTypeChainLocks; 25 18129 : const uint256 request_id = GenSigRequestId(clsig.getHeight()); 26 : 27 36258 : return llmq::VerifyRecoveredSig(llmqType, chain, qman, clsig.getHeight(), request_id, clsig.getBlockHash(), 28 18129 : clsig.getSig()); 29 : } 30 : } // namespace chainlock