@@ -2667,7 +2667,7 @@ def test_setchannel_startup_opts(node_factory, bitcoind):
26672667def test_channel_spendable (node_factory , bitcoind , anchors ):
26682668 """Test that spendable_msat is accurate"""
26692669 sats = 10 ** 6
2670- opts = {'plugin' : os .path .join (os .getcwd (), 'tests/plugins/hold_invoice.py' ), 'holdtime' : '30' }
2670+ opts = {'plugin' : os .path .join (os .getcwd (), 'tests/plugins/hold_invoice.py' )}
26712671 if anchors is False :
26722672 opts ['dev-force-features' ] = "-23"
26732673 l1 , l2 = node_factory .line_graph (2 , fundamount = sats , wait_for_announce = True ,
@@ -2693,6 +2693,8 @@ def test_channel_spendable(node_factory, bitcoind, anchors):
26932693 # hold_invoice.py plugin.
26942694 wait_for (lambda : len (l1 .rpc .listpeerchannels ()['channels' ][0 ]['htlcs' ]) == 1 )
26952695 assert l1 .rpc .listpeerchannels ()['channels' ][0 ]['spendable_msat' ] == Millisatoshi (0 )
2696+ # Tell hold_invoice.py to release hold
2697+ open (os .path .join (l2 .daemon .lightning_dir , TEST_NETWORK , "unhold" ), "w" ).close ()
26962698 l1 .rpc .waitsendpay (payment_hash , TIMEOUT )
26972699
26982700 # Make sure l2 thinks it's all over.
@@ -2718,14 +2720,15 @@ def test_channel_spendable(node_factory, bitcoind, anchors):
27182720 # hold_invoice.py plugin.
27192721 wait_for (lambda : len (l2 .rpc .listpeerchannels ()['channels' ][0 ]['htlcs' ]) == 1 )
27202722 assert l2 .rpc .listpeerchannels ()['channels' ][0 ]['spendable_msat' ] == Millisatoshi (0 )
2723+ open (os .path .join (l1 .daemon .lightning_dir , TEST_NETWORK , "unhold" ), "w" ).close ()
27212724 l2 .rpc .waitsendpay (payment_hash , TIMEOUT )
27222725
27232726
27242727def test_channel_receivable (node_factory , bitcoind ):
27252728 """Test that receivable_msat is accurate"""
27262729 sats = 10 ** 6
27272730 l1 , l2 = node_factory .line_graph (2 , fundamount = sats , wait_for_announce = True ,
2728- opts = {'plugin' : os .path .join (os .getcwd (), 'tests/plugins/hold_invoice.py' ), 'holdtime' : '30' })
2731+ opts = {'plugin' : os .path .join (os .getcwd (), 'tests/plugins/hold_invoice.py' )})
27292732
27302733 inv = l2 .rpc .invoice ('any' , 'inv' , 'for testing' )
27312734 payment_hash = inv ['payment_hash' ]
@@ -2747,6 +2750,7 @@ def test_channel_receivable(node_factory, bitcoind):
27472750 # hold_invoice.py plugin.
27482751 wait_for (lambda : len (l2 .rpc .listpeerchannels ()['channels' ][0 ]['htlcs' ]) == 1 )
27492752 assert l2 .rpc .listpeerchannels ()['channels' ][0 ]['receivable_msat' ] == Millisatoshi (0 )
2753+ open (os .path .join (l2 .daemon .lightning_dir , TEST_NETWORK , "unhold" ), "w" ).close ()
27502754 l1 .rpc .waitsendpay (payment_hash , TIMEOUT )
27512755
27522756 # Make sure both think it's all over.
@@ -2773,6 +2777,7 @@ def test_channel_receivable(node_factory, bitcoind):
27732777 # hold_invoice.py plugin.
27742778 wait_for (lambda : len (l1 .rpc .listpeerchannels ()['channels' ][0 ]['htlcs' ]) == 1 )
27752779 assert l1 .rpc .listpeerchannels ()['channels' ][0 ]['receivable_msat' ] == Millisatoshi (0 )
2780+ open (os .path .join (l1 .daemon .lightning_dir , TEST_NETWORK , "unhold" ), "w" ).close ()
27762781 l2 .rpc .waitsendpay (payment_hash , TIMEOUT )
27772782
27782783
@@ -2786,7 +2791,6 @@ def test_channel_spendable_large(node_factory, bitcoind):
27862791 wait_for_announce = True ,
27872792 opts = {
27882793 'plugin' : os .path .join (os .getcwd (), 'tests/plugins/hold_invoice.py' ),
2789- 'holdtime' : '30'
27902794 }
27912795 )
27922796
@@ -2809,6 +2813,7 @@ def test_channel_spendable_large(node_factory, bitcoind):
28092813 # Exact amount should succeed.
28102814 route = l1 .rpc .getroute (l2 .info ['id' ], spendable , riskfactor = 1 , fuzzpercent = 0 )['route' ]
28112815 l1 .rpc .sendpay (route , payment_hash , payment_secret = inv ['payment_secret' ])
2816+ open (os .path .join (l2 .daemon .lightning_dir , TEST_NETWORK , "unhold" ), "w" ).close ()
28122817 l1 .rpc .waitsendpay (payment_hash , TIMEOUT )
28132818
28142819
0 commit comments