mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
fix!: Return FinalCommitment in qrinfo (instead of simply quorumHash) (#4850)
This commit is contained in:
parent
145fee358d
commit
3fcfe3f176
@ -90,12 +90,13 @@ void CQuorumRotationInfo::ToJson(UniValue& obj) const
|
|||||||
mnListDiffAtHMinus4C.value().ToJson(objdiff4c);
|
mnListDiffAtHMinus4C.value().ToJson(objdiff4c);
|
||||||
obj.pushKV("mnListDiffAtHMinus4C", objdiff4c);
|
obj.pushKV("mnListDiffAtHMinus4C", objdiff4c);
|
||||||
}
|
}
|
||||||
|
UniValue hqclists(UniValue::VARR);
|
||||||
UniValue hlists(UniValue::VARR);
|
for (const auto& qc : lastCommitmentPerIndex) {
|
||||||
for (const auto& h : lastQuorumHashPerIndex) {
|
UniValue objqc;
|
||||||
hlists.push_back(h.ToString());
|
qc.ToJson(objqc);
|
||||||
|
hqclists.push_back(objqc);
|
||||||
}
|
}
|
||||||
obj.pushKV("lastQuorumHashPerIndex", hlists);
|
obj.pushKV("lastCommitmentPerIndex", hqclists);
|
||||||
|
|
||||||
UniValue snapshotlist(UniValue::VARR);
|
UniValue snapshotlist(UniValue::VARR);
|
||||||
for (const auto& snap : quorumSnapshotList) {
|
for (const auto& snap : quorumSnapshotList) {
|
||||||
@ -298,7 +299,12 @@ bool BuildQuorumRotationInfo(const CGetQuorumRotationInfo& request, CQuorumRotat
|
|||||||
std::vector<std::pair<int, const CBlockIndex*>> qdata = quorumBlockProcessor->GetLastMinedCommitmentsPerQuorumIndexUntilBlock(llmqType, blockIndex, 0);
|
std::vector<std::pair<int, const CBlockIndex*>> qdata = quorumBlockProcessor->GetLastMinedCommitmentsPerQuorumIndexUntilBlock(llmqType, blockIndex, 0);
|
||||||
|
|
||||||
for (const auto& obj : qdata) {
|
for (const auto& obj : qdata) {
|
||||||
response.lastQuorumHashPerIndex.push_back(obj.second->GetBlockHash());
|
uint256 minedBlockHash;
|
||||||
|
llmq::CFinalCommitmentPtr qc = llmq::quorumBlockProcessor->GetMinedCommitment(llmqType, obj.second->GetBlockHash(), minedBlockHash);
|
||||||
|
if (qc == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
response.lastCommitmentPerIndex.push_back(*qc);
|
||||||
|
|
||||||
int quorumCycleStartHeight = obj.second->nHeight - (obj.second->nHeight % llmqParams.dkgInterval);
|
int quorumCycleStartHeight = obj.second->nHeight - (obj.second->nHeight % llmqParams.dkgInterval);
|
||||||
snapshotHeightsNeeded.insert(quorumCycleStartHeight - cycleLength);
|
snapshotHeightsNeeded.insert(quorumCycleStartHeight - cycleLength);
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <evo/evodb.h>
|
#include <evo/evodb.h>
|
||||||
#include <evo/simplifiedmns.h>
|
#include <evo/simplifiedmns.h>
|
||||||
|
#include <llmq/commitment.h>
|
||||||
#include <llmq/params.h>
|
#include <llmq/params.h>
|
||||||
#include <saltedhasher.h>
|
#include <saltedhasher.h>
|
||||||
#include <serialize.h>
|
#include <serialize.h>
|
||||||
@ -115,7 +116,7 @@ public:
|
|||||||
std::optional<CQuorumSnapshot> quorumSnapshotAtHMinus4C;
|
std::optional<CQuorumSnapshot> quorumSnapshotAtHMinus4C;
|
||||||
std::optional<CSimplifiedMNListDiff> mnListDiffAtHMinus4C;
|
std::optional<CSimplifiedMNListDiff> mnListDiffAtHMinus4C;
|
||||||
|
|
||||||
std::vector<uint256> lastQuorumHashPerIndex;
|
std::vector<llmq::CFinalCommitment> lastCommitmentPerIndex;
|
||||||
std::vector<CQuorumSnapshot> quorumSnapshotList;
|
std::vector<CQuorumSnapshot> quorumSnapshotList;
|
||||||
std::vector<CSimplifiedMNListDiff> mnListDiffList;
|
std::vector<CSimplifiedMNListDiff> mnListDiffList;
|
||||||
|
|
||||||
@ -146,8 +147,8 @@ public:
|
|||||||
::Serialize(s, mnListDiffAtHMinus4C.value());
|
::Serialize(s, mnListDiffAtHMinus4C.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteCompactSize(s, lastQuorumHashPerIndex.size());
|
WriteCompactSize(s, lastCommitmentPerIndex.size());
|
||||||
for (const auto& obj : lastQuorumHashPerIndex) {
|
for (const auto& obj : lastCommitmentPerIndex) {
|
||||||
::Serialize(s, obj);
|
::Serialize(s, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,8 +179,9 @@ public:
|
|||||||
size_t cnt = ReadCompactSize(s);
|
size_t cnt = ReadCompactSize(s);
|
||||||
for ([[maybe_unused]] const auto _ : irange::range(cnt)) {
|
for ([[maybe_unused]] const auto _ : irange::range(cnt)) {
|
||||||
uint256 hash;
|
uint256 hash;
|
||||||
::Unserialize(s, hash);
|
CFinalCommitment qc;
|
||||||
lastQuorumHashPerIndex.push_back(std::move(hash));
|
::Unserialize(s, qc);
|
||||||
|
lastCommitmentPerIndex.push_back(std::move(qc));
|
||||||
}
|
}
|
||||||
|
|
||||||
cnt = ReadCompactSize(s);
|
cnt = ReadCompactSize(s);
|
||||||
|
Loading…
Reference in New Issue
Block a user