Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions test/functional/feature_llmq_data_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
RECOVERY_TRIGGER_LOG = "TriggerQuorumDataRecoveryThreads -- Process block"


def clsig_request_id(height):
return hash256(ser_string(b"clsig") + struct.pack("<I", height))[::-1].hex()


class QuorumDataRecoveryTest(DashTestFramework):
def add_options(self, parser):
self.add_wallet_options(parser)
Expand Down Expand Up @@ -119,8 +123,7 @@ def test_no_chainlock(self, node):
"""Mine a block and show that the quorum that has to sign it can not: every masternode tried to sign it,
fewer members of the signing quorum than the signing threshold hold their secret key share, each of
those has signed the block, and no ChainLock formed"""
height = node.getblockcount() + 1
request_id = hash256(ser_string(b"clsig") + struct.pack("<I", height))[::-1].hex()
request_id = clsig_request_id(node.getblockcount() + 1)
log_positions = self.debug_log_positions(self.mninfo)
block_hash = self.generate(node, 1, sync_fun=self.sync_validation)[0]
# Logged before the InstantSend safety gate: a block with a transaction that is neither islocked nor old
Expand Down Expand Up @@ -244,9 +247,15 @@ def run_test(self):
# which trigger CQuorumManger::TriggerQuorumDataRecoveryThreads()
self.test_mns(llmq_test, quorum_hash_recover, valid_mns=member_mns_recover_test, recover=True)
self.test_mns(llmq_test_v17, quorum_hash_recover, valid_mns=member_mns_recover_v17, recover=True)
# Mining a block should result in a chainlock now because the quorum should be healed. The tip that the
# recovery loop mined last may have been signed before every member held its key share again.
self.generate(node, 1, sync_fun=self.sync_validation)
# A block signed by the healed quorum should be chainlocked now. The tip that the recovery loop mined last
# may have been signed before every member held its key share again, and a block signed by the other active
# quorum depends on members of it this test does not wait for, so mine until the healed quorum signs.

def mine_tip_for_healed_quorum():
self.generate(node, 1, sync_fun=self.sync_validation)
request_id = clsig_request_id(node.getblockcount())
return node.quorum("selectquorum", llmq_test, request_id)["quorumHash"] == quorum_hash_recover
self.wait_until(mine_tip_for_healed_quorum)
self.wait_for_chainlocked_block_all_nodes(node.getbestblockhash())
logger.info("Test -llmq-qvvec-sync command line parameter")
self.test_llmq_qvvec_sync([(llmq_test, 0), (llmq_test_v17, 1)])
Expand Down
Loading