Skip to content

Commit

Permalink
more reorg tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ouziel committed Jan 10, 2025
1 parent 447f69c commit e6bd184
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion counterparty-core/counterpartycore/test/regtest/regtestnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ def test_reorg(self):
print("Final XCP balance: ", final_xcp_balance)
assert final_xcp_balance == initial_xcp_balance

# Test reorg with a shorter chain of one block
# Test reorg with same length chain but one different block
print("Disconnect from the first node...")
self.bitcoin_cli_2("disconnectnode", "localhost:18445")

Expand All @@ -711,6 +711,20 @@ def test_reorg(self):
print("Waiting for reorg...")
assert retry < 100

# Test reorg with a same length chain but three different blocks
print("Invalidate block ", last_block - 3)
previous_block_hash = self.bitcoin_cli("getblockhash", last_block - 3).strip()
self.bitcoin_cli("invalidateblock", previous_block_hash)
self.mine_blocks(3)
retry = 0
while len(self.server_out.getvalue().split(f"Hashes don't match ({last_block - 3})")) < 3:
time.sleep(1)
retry += 1
print("Waiting for reorg...")
assert retry < 100

self.wait_for_counterparty_server(last_block)

print("Reorg test successful")

def test_electrs(self):
Expand Down

0 comments on commit e6bd184

Please sign in to comment.