Skip to content

Commit

Permalink
Fix LLMQ signing integration tests (#2640)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
codablock authored and UdjinM6 committed Jan 23, 2019
1 parent 5977486 commit b595f9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions qa/rpc-tests/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,21 +408,23 @@ 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()
while time() - t < timeout:
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")
Expand Down
3 changes: 2 additions & 1 deletion src/llmq/quorums_signing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ void CRecoveredSigsDb::CleanupOldRecoveredSigs(int64_t maxAge)
{
std::unique_ptr<CDBIterator> 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<std::pair<Consensus::LLMQType, uint256>> toDelete;
Expand Down

0 comments on commit b595f9e

Please sign in to comment.