@@ -1225,7 +1225,7 @@ def test_permfail(self):
1225
1225
l1 .daemon .wait_for_log ('Their unilateral tx, old commit point' )
1226
1226
l1 .daemon .wait_for_log (' to ONCHAIN' )
1227
1227
l2 .daemon .wait_for_log (' to ONCHAIN' )
1228
- l2 .daemon .wait_for_log ('Propose handling OUR_UNILATERAL/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET (.*) in 5 blocks' )
1228
+ l2 .daemon .wait_for_log ('Propose handling OUR_UNILATERAL/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET (.*) after 5 blocks' )
1229
1229
1230
1230
wait_for (lambda : l1 .rpc .listpeers (l2 .info ['id' ])['peers' ][0 ]['channels' ][0 ]['status' ] ==
1231
1231
['CHANNELD_NORMAL:Received error from peer: channel ALL: Internal error: Failing due to dev-fail command' ,
@@ -1430,11 +1430,13 @@ def test_onchain_timeout(self):
1430
1430
l2 .daemon .wait_for_log (' to ONCHAIN' )
1431
1431
1432
1432
# Wait for timeout.
1433
- l1 .daemon .wait_for_log ('Propose handling OUR_UNILATERAL/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* in 5 blocks' )
1434
- bitcoind .generate_block (5 )
1433
+ l1 .daemon .wait_for_logs (['Propose handling OUR_UNILATERAL/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* after 5 blocks' ,
1434
+ 'Propose handling OUR_UNILATERAL/OUR_HTLC by OUR_HTLC_TIMEOUT_TX .* after 6 blocks' ])
1435
+ bitcoind .generate_block (4 )
1435
1436
1436
- # (l1 will also collect its to-self payment.)
1437
1437
l1 .daemon .wait_for_log ('sendrawtx exit 0' )
1438
+
1439
+ bitcoind .generate_block (1 )
1438
1440
l1 .daemon .wait_for_log ('sendrawtx exit 0' )
1439
1441
1440
1442
# We use 3 blocks for "reasonable depth"
@@ -1456,6 +1458,7 @@ def test_onchain_timeout(self):
1456
1458
1457
1459
# Now, 100 blocks and l1 should be done.
1458
1460
bitcoind .generate_block (10 )
1461
+ sync_blockheight ([l1 ])
1459
1462
assert not l1 .daemon .is_in_log ('onchaind complete, forgetting peer' )
1460
1463
bitcoind .generate_block (1 )
1461
1464
l1 .daemon .wait_for_log ('onchaind complete, forgetting peer' )
@@ -1510,7 +1513,7 @@ def try_pay():
1510
1513
l2 .daemon .wait_for_log ('OUR_UNILATERAL/THEIR_HTLC' )
1511
1514
1512
1515
# l2 should fulfill HTLC onchain, and spend to-us (any order)
1513
- l2 .daemon .wait_for_log ('Propose handling OUR_UNILATERAL/THEIR_HTLC by OUR_HTLC_SUCCESS_TX .* in 0 blocks' )
1516
+ l2 .daemon .wait_for_log ('Propose handling OUR_UNILATERAL/THEIR_HTLC by OUR_HTLC_SUCCESS_TX .* after 0 blocks' )
1514
1517
l2 .daemon .wait_for_log ('sendrawtx exit 0' )
1515
1518
1516
1519
# Payment should succeed.
@@ -1587,9 +1590,9 @@ def test_penalty_inhtlc(self):
1587
1590
1588
1591
# l2 should spend all of the outputs (except to-us).
1589
1592
# Could happen in any order, depending on commitment tx.
1590
- l2 .daemon .wait_for_logs (['Propose handling THEIR_REVOKED_UNILATERAL/DELAYED_OUTPUT_TO_THEM by OUR_PENALTY_TX .* in 0 blocks' ,
1593
+ l2 .daemon .wait_for_logs (['Propose handling THEIR_REVOKED_UNILATERAL/DELAYED_OUTPUT_TO_THEM by OUR_PENALTY_TX .* after 0 blocks' ,
1591
1594
'sendrawtx exit 0' ,
1592
- 'Propose handling THEIR_REVOKED_UNILATERAL/THEIR_HTLC by OUR_PENALTY_TX .* in 0 blocks' ,
1595
+ 'Propose handling THEIR_REVOKED_UNILATERAL/THEIR_HTLC by OUR_PENALTY_TX .* after 0 blocks' ,
1593
1596
'sendrawtx exit 0' ])
1594
1597
1595
1598
# FIXME: test HTLC tx race!
@@ -1650,9 +1653,9 @@ def test_penalty_outhtlc(self):
1650
1653
# l2 should spend all of the outputs (except to-us).
1651
1654
# Could happen in any order, depending on commitment tx.
1652
1655
l2 .daemon .wait_for_logs (['Ignoring output.*: THEIR_REVOKED_UNILATERAL/OUTPUT_TO_US' ,
1653
- 'Propose handling THEIR_REVOKED_UNILATERAL/DELAYED_OUTPUT_TO_THEM by OUR_PENALTY_TX .* in 0 blocks' ,
1656
+ 'Propose handling THEIR_REVOKED_UNILATERAL/DELAYED_OUTPUT_TO_THEM by OUR_PENALTY_TX .* after 0 blocks' ,
1654
1657
'sendrawtx exit 0' ,
1655
- 'Propose handling THEIR_REVOKED_UNILATERAL/OUR_HTLC by OUR_PENALTY_TX .* in 0 blocks' ,
1658
+ 'Propose handling THEIR_REVOKED_UNILATERAL/OUR_HTLC by OUR_PENALTY_TX .* after 0 blocks' ,
1656
1659
'sendrawtx exit 0' ])
1657
1660
1658
1661
# FIXME: test HTLC tx race!
@@ -1695,7 +1698,7 @@ def test_onchain_feechange(self):
1695
1698
l2 .daemon .wait_for_log (' to ONCHAIN' )
1696
1699
1697
1700
# Wait for timeout.
1698
- l1 .daemon .wait_for_log ('Propose handling THEIR_UNILATERAL/OUR_HTLC by OUR_HTLC_TIMEOUT_TO_US .* in 6 blocks' )
1701
+ l1 .daemon .wait_for_log ('Propose handling THEIR_UNILATERAL/OUR_HTLC by OUR_HTLC_TIMEOUT_TO_US .* after 6 blocks' )
1699
1702
bitcoind .generate_block (6 )
1700
1703
1701
1704
l1 .daemon .wait_for_log ('sendrawtx exit 0' )
@@ -1773,7 +1776,7 @@ def test_onchain_all_dust(self):
1773
1776
l2 .daemon .wait_for_log (' to ONCHAIN' )
1774
1777
1775
1778
# Wait for timeout.
1776
- l1 .daemon .wait_for_log ('Propose handling THEIR_UNILATERAL/OUR_HTLC by DONATING_TO_MINERS .* in 6 blocks' )
1779
+ l1 .daemon .wait_for_log ('Propose handling THEIR_UNILATERAL/OUR_HTLC by DONATING_TO_MINERS .* after 6 blocks' )
1777
1780
bitcoind .generate_block (6 )
1778
1781
1779
1782
l1 .daemon .wait_for_log ('sendrawtx exit 0' )
@@ -1814,8 +1817,8 @@ def test_permfail_new_commit(self):
1814
1817
l1 .daemon .wait_for_log ('Their unilateral tx, new commit point' )
1815
1818
l1 .daemon .wait_for_log (' to ONCHAIN' )
1816
1819
l2 .daemon .wait_for_log (' to ONCHAIN' )
1817
- l2 .daemon .wait_for_log ('Propose handling OUR_UNILATERAL/THEIR_HTLC by THEIR_HTLC_TIMEOUT_TO_THEM \\ (IGNORING\\ ) in 6 blocks' )
1818
- l1 .daemon .wait_for_log ('Propose handling THEIR_UNILATERAL/OUR_HTLC by OUR_HTLC_TIMEOUT_TO_US (.*) in 6 blocks' )
1820
+ l2 .daemon .wait_for_log ('Propose handling OUR_UNILATERAL/THEIR_HTLC by THEIR_HTLC_TIMEOUT_TO_THEM \\ (IGNORING\\ ) after 6 blocks' )
1821
+ l1 .daemon .wait_for_log ('Propose handling THEIR_UNILATERAL/OUR_HTLC by OUR_HTLC_TIMEOUT_TO_US (.*) after 6 blocks' )
1819
1822
1820
1823
# OK, time out HTLC.
1821
1824
bitcoind .generate_block (5 )
@@ -1850,16 +1853,16 @@ def test_permfail_htlc_in(self):
1850
1853
l1 .daemon .wait_for_log ('Their unilateral tx, old commit point' )
1851
1854
l1 .daemon .wait_for_log (' to ONCHAIN' )
1852
1855
l2 .daemon .wait_for_log (' to ONCHAIN' )
1853
- l2 .daemon .wait_for_log ('Propose handling OUR_UNILATERAL/THEIR_HTLC by THEIR_HTLC_TIMEOUT_TO_THEM \\ (IGNORING\\ ) in 6 blocks' )
1854
- l1 .daemon .wait_for_log ('Propose handling THEIR_UNILATERAL/OUR_HTLC by OUR_HTLC_TIMEOUT_TO_US (.*) in 6 blocks' )
1856
+ l2 .daemon .wait_for_log ('Propose handling OUR_UNILATERAL/THEIR_HTLC by THEIR_HTLC_TIMEOUT_TO_THEM \\ (IGNORING\\ ) after 6 blocks' )
1857
+ l1 .daemon .wait_for_log ('Propose handling THEIR_UNILATERAL/OUR_HTLC by OUR_HTLC_TIMEOUT_TO_US (.*) after 6 blocks' )
1855
1858
# l2 then gets preimage, uses it instead of ignoring
1856
- l2 .daemon .wait_for_log ('Propose handling OUR_UNILATERAL/THEIR_HTLC by OUR_HTLC_SUCCESS_TX .* in 0 blocks' )
1859
+ l2 .daemon .wait_for_log ('Propose handling OUR_UNILATERAL/THEIR_HTLC by OUR_HTLC_SUCCESS_TX .* after 0 blocks' )
1857
1860
l2 .daemon .wait_for_log ('sendrawtx exit 0' )
1858
1861
bitcoind .generate_block (1 )
1859
1862
1860
1863
# OK, l1 sees l2 fulfill htlc.
1861
1864
l1 .daemon .wait_for_log ('THEIR_UNILATERAL/OUR_HTLC gave us preimage' )
1862
- l2 .daemon .wait_for_log ('Propose handling OUR_HTLC_SUCCESS_TX/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* in 5 blocks' )
1865
+ l2 .daemon .wait_for_log ('Propose handling OUR_HTLC_SUCCESS_TX/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* after 5 blocks' )
1863
1866
bitcoind .generate_block (6 )
1864
1867
1865
1868
l2 .daemon .wait_for_log ('sendrawtx exit 0' )
@@ -1892,12 +1895,12 @@ def test_permfail_htlc_out(self):
1892
1895
l1 .daemon .wait_for_log ('Their unilateral tx, old commit point' )
1893
1896
l1 .daemon .wait_for_log (' to ONCHAIN' )
1894
1897
l2 .daemon .wait_for_log (' to ONCHAIN' )
1895
- l2 .daemon .wait_for_logs (['Propose handling OUR_UNILATERAL/OUR_HTLC by OUR_HTLC_TIMEOUT_TX \\ (.*\\ ) in 6 blocks' ,
1896
- 'Propose handling OUR_UNILATERAL/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* in 5 blocks' ])
1898
+ l2 .daemon .wait_for_logs (['Propose handling OUR_UNILATERAL/OUR_HTLC by OUR_HTLC_TIMEOUT_TX \\ (.*\\ ) after 6 blocks' ,
1899
+ 'Propose handling OUR_UNILATERAL/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* after 5 blocks' ])
1897
1900
1898
- l1 .daemon .wait_for_log ('Propose handling THEIR_UNILATERAL/THEIR_HTLC by THEIR_HTLC_TIMEOUT_TO_THEM \\ (IGNORING\\ ) in 6 blocks' )
1901
+ l1 .daemon .wait_for_log ('Propose handling THEIR_UNILATERAL/THEIR_HTLC by THEIR_HTLC_TIMEOUT_TO_THEM \\ (IGNORING\\ ) after 6 blocks' )
1899
1902
# l1 then gets preimage, uses it instead of ignoring
1900
- l1 .daemon .wait_for_log ('Propose handling THEIR_UNILATERAL/THEIR_HTLC by THEIR_HTLC_FULFILL_TO_US .* in 0 blocks' )
1903
+ l1 .daemon .wait_for_log ('Propose handling THEIR_UNILATERAL/THEIR_HTLC by THEIR_HTLC_FULFILL_TO_US .* after 0 blocks' )
1901
1904
l1 .daemon .wait_for_log ('sendrawtx exit 0' )
1902
1905
1903
1906
# l2 sees l1 fulfill tx.
@@ -1906,19 +1909,22 @@ def test_permfail_htlc_out(self):
1906
1909
l2 .daemon .wait_for_log ('OUR_UNILATERAL/OUR_HTLC gave us preimage' )
1907
1910
t .cancel ()
1908
1911
1909
- # l2 can send OUR_DELAYED_RETURN_TO_WALLET after 4 more blocks.
1910
- bitcoind .generate_block (4 )
1912
+ # l2 can send OUR_DELAYED_RETURN_TO_WALLET after 3 more blocks.
1913
+ bitcoind .generate_block (3 )
1911
1914
l2 .daemon .wait_for_log ('Broadcasting OUR_DELAYED_RETURN_TO_WALLET .* to resolve OUR_UNILATERAL/DELAYED_OUTPUT_TO_US' )
1912
1915
l2 .daemon .wait_for_log ('sendrawtx exit 0' )
1913
1916
1914
1917
# Now, 100 blocks they should be done.
1915
- bitcoind .generate_block (94 )
1918
+ bitcoind .generate_block (95 )
1919
+ sync_blockheight ([l1 , l2 ])
1916
1920
assert not l1 .daemon .is_in_log ('onchaind complete, forgetting peer' )
1917
1921
assert not l2 .daemon .is_in_log ('onchaind complete, forgetting peer' )
1918
1922
bitcoind .generate_block (1 )
1919
1923
l1 .daemon .wait_for_log ('onchaind complete, forgetting peer' )
1924
+ sync_blockheight ([l2 ])
1920
1925
assert not l2 .daemon .is_in_log ('onchaind complete, forgetting peer' )
1921
- bitcoind .generate_block (5 )
1926
+ bitcoind .generate_block (3 )
1927
+ sync_blockheight ([l2 ])
1922
1928
assert not l2 .daemon .is_in_log ('onchaind complete, forgetting peer' )
1923
1929
bitcoind .generate_block (1 )
1924
1930
wait_forget_channels (l2 )
@@ -2469,14 +2475,14 @@ def test_htlc_out_timeout(self):
2469
2475
l2 .daemon .wait_for_log (' to ONCHAIN' )
2470
2476
2471
2477
# L1 will timeout HTLC immediately
2472
- l1 .daemon .wait_for_logs (['Propose handling OUR_UNILATERAL/OUR_HTLC by OUR_HTLC_TIMEOUT_TX .* in 0 blocks' ,
2473
- 'Propose handling OUR_UNILATERAL/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* in 5 blocks' ])
2478
+ l1 .daemon .wait_for_logs (['Propose handling OUR_UNILATERAL/OUR_HTLC by OUR_HTLC_TIMEOUT_TX .* after 0 blocks' ,
2479
+ 'Propose handling OUR_UNILATERAL/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* after 5 blocks' ])
2474
2480
2475
2481
l1 .daemon .wait_for_log ('sendrawtx exit 0' )
2476
2482
bitcoind .generate_block (1 )
2477
2483
2478
- l1 .daemon .wait_for_log ('Propose handling OUR_HTLC_TIMEOUT_TX/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* in 5 blocks' )
2479
- bitcoind .generate_block (5 )
2484
+ l1 .daemon .wait_for_log ('Propose handling OUR_HTLC_TIMEOUT_TX/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* after 5 blocks' )
2485
+ bitcoind .generate_block (4 )
2480
2486
# It should now claim both the to-local and htlc-timeout-tx outputs.
2481
2487
l1 .daemon .wait_for_logs (['Broadcasting OUR_DELAYED_RETURN_TO_WALLET' ,
2482
2488
'Broadcasting OUR_DELAYED_RETURN_TO_WALLET' ,
@@ -2524,11 +2530,11 @@ def test_htlc_in_timeout(self):
2524
2530
l1 .daemon .wait_for_log (' to ONCHAIN' )
2525
2531
2526
2532
# L2 will collect HTLC
2527
- l2 .daemon .wait_for_log ('Propose handling OUR_UNILATERAL/THEIR_HTLC by OUR_HTLC_SUCCESS_TX .* in 0 blocks' )
2533
+ l2 .daemon .wait_for_log ('Propose handling OUR_UNILATERAL/THEIR_HTLC by OUR_HTLC_SUCCESS_TX .* after 0 blocks' )
2528
2534
l2 .daemon .wait_for_log ('sendrawtx exit 0' )
2529
2535
bitcoind .generate_block (1 )
2530
- l2 .daemon .wait_for_log ('Propose handling OUR_HTLC_SUCCESS_TX/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* in 5 blocks' )
2531
- bitcoind .generate_block (5 )
2536
+ l2 .daemon .wait_for_log ('Propose handling OUR_HTLC_SUCCESS_TX/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* after 5 blocks' )
2537
+ bitcoind .generate_block (4 )
2532
2538
l2 .daemon .wait_for_log ('Broadcasting OUR_DELAYED_RETURN_TO_WALLET' )
2533
2539
l2 .daemon .wait_for_log ('sendrawtx exit 0' )
2534
2540
0 commit comments