mirror of
https://github.com/aljazceru/python-teos.git
synced 2026-02-03 13:44:29 +01:00
Fixes test_appointment_malformed_penalty
This commit is contained in:
@@ -159,15 +159,16 @@ def test_multiple_appointments_life_cycle(bitcoin_cli):
|
|||||||
|
|
||||||
# Create five appointments.
|
# Create five appointments.
|
||||||
for commitment_tx, penalty_tx in zip(commitment_txs, penalty_txs):
|
for commitment_tx, penalty_tx in zip(commitment_txs, penalty_txs):
|
||||||
appointment = {}
|
|
||||||
|
|
||||||
appointment["commitment_tx"] = commitment_tx
|
|
||||||
appointment["penalty_tx"] = penalty_tx
|
|
||||||
commitment_tx_id = bitcoin_cli.decoderawtransaction(commitment_tx).get("txid")
|
commitment_tx_id = bitcoin_cli.decoderawtransaction(commitment_tx).get("txid")
|
||||||
appointment_data = build_appointment_data(bitcoin_cli, commitment_tx_id, penalty_tx)
|
appointment_data = build_appointment_data(bitcoin_cli, commitment_tx_id, penalty_tx)
|
||||||
appointment["appointment_data"] = appointment_data
|
|
||||||
locator = compute_locator(commitment_tx_id)
|
locator = compute_locator(commitment_tx_id)
|
||||||
appointment["locator"] = locator
|
appointment = {
|
||||||
|
"locator": locator,
|
||||||
|
"commitment_tx": commitment_tx,
|
||||||
|
"penalty_tx": penalty_tx,
|
||||||
|
"appointment_data": appointment_data,
|
||||||
|
}
|
||||||
|
|
||||||
appointments.append(appointment)
|
appointments.append(appointment)
|
||||||
|
|
||||||
@@ -192,18 +193,15 @@ def test_multiple_appointments_life_cycle(bitcoin_cli):
|
|||||||
responder_locators = [appointment["locator"] for uuid, appointment in responding.items()]
|
responder_locators = [appointment["locator"] for uuid, appointment in responding.items()]
|
||||||
assert set(responder_locators) == set(breached_appointments)
|
assert set(responder_locators) == set(breached_appointments)
|
||||||
|
|
||||||
# Now let's mine some blocks so these appointments reach the end of their lifecycle.
|
|
||||||
# Since we are running all the nodes remotely data may take more time than normal, and some confirmations may be
|
|
||||||
# missed, so we generate more than enough confirmations and add some delays.
|
|
||||||
new_addr = bitcoin_cli.getnewaddress()
|
new_addr = bitcoin_cli.getnewaddress()
|
||||||
for _ in range(int(1.5 * END_TIME_DELTA) + 5):
|
# Now let's mine some blocks so the appointment reaches its end.
|
||||||
sleep(1)
|
|
||||||
for _ in range(END_TIME_DELTA):
|
for _ in range(END_TIME_DELTA):
|
||||||
bitcoin_cli.generatetoaddress(1, new_addr)
|
bitcoin_cli.generatetoaddress(1, new_addr)
|
||||||
|
|
||||||
# The appointment is no longer in the tower
|
# The appointment is no longer in the tower
|
||||||
with pytest.raises(TowerResponseError):
|
with pytest.raises(TowerResponseError):
|
||||||
get_appointment_info(locator)
|
for appointment in appointments:
|
||||||
|
get_appointment_info(appointment["locator"])
|
||||||
|
|
||||||
|
|
||||||
def test_appointment_malformed_penalty(bitcoin_cli):
|
def test_appointment_malformed_penalty(bitcoin_cli):
|
||||||
|
|||||||
Reference in New Issue
Block a user