@@ -76,15 +76,13 @@ bool BuildQuorumRotationInfo(CDeterministicMNManager& dmnman, CQuorumSnapshotMan
7676 }
7777 baseBlockIndexes.push_back (blockIndex);
7878 }
79- if (use_legacy_construction) {
80- // Legacy construction (served to peers < EFFICIENT_QRINFO_VERSION) only needs the
81- // input sorted; do not deduplicate so the wire response stays bit-for-bit identical
82- // to the pre-fix behavior for older peers.
83- std::sort (baseBlockIndexes.begin (), baseBlockIndexes.end (),
84- [](const CBlockIndex* a, const CBlockIndex* b) { return a->nHeight < b->nHeight ; });
85- } else {
86- std::sort (baseBlockIndexes.begin (), baseBlockIndexes.end (),
87- [](const CBlockIndex* a, const CBlockIndex* b) { return a->nHeight < b->nHeight ; });
79+ // Sort in all cases: the legacy path (served to peers < EFFICIENT_QRINFO_VERSION)
80+ // relies on the order for baseBlockIndexes.back() and GetLastBaseBlockHash().
81+ std::sort (baseBlockIndexes.begin (), baseBlockIndexes.end (),
82+ [](const CBlockIndex* a, const CBlockIndex* b) { return a->nHeight < b->nHeight ; });
83+ if (!use_legacy_construction) {
84+ // Only deduplicate on the non-legacy path; leave the legacy path untouched so the
85+ // wire response to older peers stays bit-for-bit identical to the pre-fix behavior.
8886 baseBlockIndexes.erase (std::unique (baseBlockIndexes.begin (), baseBlockIndexes.end ()),
8987 baseBlockIndexes.end ());
9088 }
0 commit comments