Skip to content

Commit 1f16cf4

Browse files
UdjinM6PastaPastaPasta
authored andcommitted
fix: sort indexes in GetLastBaseBlockHash
1 parent 810ecd8 commit 1f16cf4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/llmq/snapshot.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ bool BuildQuorumRotationInfo(CDeterministicMNManager& dmnman, CQuorumSnapshotMan
112112
}
113113
baseBlockIndexes.push_back(blockIndex);
114114
}
115-
std::sort(baseBlockIndexes.begin(), baseBlockIndexes.end(), [](const CBlockIndex* a, const CBlockIndex* b) {
116-
return a->nHeight < b->nHeight;
117-
});
118115
}
119116

120117
const CBlockIndex* tipBlockIndex = chainman.ActiveChain().Tip();
@@ -331,6 +328,9 @@ bool BuildQuorumRotationInfo(CDeterministicMNManager& dmnman, CQuorumSnapshotMan
331328
uint256 GetLastBaseBlockHash(Span<const CBlockIndex*> baseBlockIndexes, const CBlockIndex* blockIndex)
332329
{
333330
uint256 hash;
331+
std::sort(baseBlockIndexes.begin(), baseBlockIndexes.end(), [](const CBlockIndex* a, const CBlockIndex* b) {
332+
return a->nHeight < b->nHeight;
333+
});
334334
for (const auto baseBlock : baseBlockIndexes) {
335335
if (baseBlock->nHeight >= blockIndex->nHeight)
336336
break;

0 commit comments

Comments
 (0)