From b595f9e6a11e74d9b033b1b0ccf06721857e3444 Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Wed, 23 Jan 2019 09:37:02 +0100 Subject: [PATCH] Fix LLMQ signing integration tests (#2640) * Fix cleanup of old recovered sigs When iterating the db, we should also include entries that match exactly the end time. * Fix key not found error * Raise AssertionError in case wait_for_quorum_phase/wait_for_quorum_commitment time out --- qa/rpc-tests/test_framework/test_framework.py | 8 +++++--- src/llmq/quorums_signing.cpp | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/qa/rpc-tests/test_framework/test_framework.py b/qa/rpc-tests/test_framework/test_framework.py index d183d8fbbe50f..c8ace8874e96a 100755 --- a/qa/rpc-tests/test_framework/test_framework.py +++ b/qa/rpc-tests/test_framework/test_framework.py @@ -408,8 +408,9 @@ def wait_for_quorum_phase(self, phase, check_received_messages, check_received_m all_ok = False break if all_ok: - break + return sleep(0.1) + raise AssertionError("wait_for_quorum_phase timed out") def wait_for_quorum_commitment(self, timeout = 5): t = time() @@ -417,12 +418,13 @@ def wait_for_quorum_commitment(self, timeout = 5): all_ok = True for node in self.nodes: s = node.quorum("dkgstatus")["session"]["llmq_10"] - if not s["receivedFinalCommitment"]: + if "receivedFinalCommitment" not in s or not s["receivedFinalCommitment"]: all_ok = False break if all_ok: - break + return sleep(0.1) + raise AssertionError("wait_for_quorum_commitment timed out") def mine_quorum(self, expected_valid_count=10): quorums = self.nodes[0].quorum("list") diff --git a/src/llmq/quorums_signing.cpp b/src/llmq/quorums_signing.cpp index 03d35907fc082..6804d20c5a0eb 100644 --- a/src/llmq/quorums_signing.cpp +++ b/src/llmq/quorums_signing.cpp @@ -119,8 +119,9 @@ void CRecoveredSigsDb::CleanupOldRecoveredSigs(int64_t maxAge) { std::unique_ptr pcursor(db.NewIterator()); + static const uint256 maxUint256 = uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); auto start = std::make_tuple('t', (uint32_t)0, (uint8_t)0, uint256()); - auto end = std::make_tuple('t', (uint32_t)(GetAdjustedTime() - maxAge), (uint8_t)0, uint256()); + auto end = std::make_tuple('t', (uint32_t)(GetAdjustedTime() - maxAge), (uint8_t)255, maxUint256); pcursor->Seek(start); std::vector> toDelete;