@@ -3578,15 +3578,19 @@ def test_channel_features(node_factory, bitcoind, anchors):
3578
3578
3579
3579
def test_nonstatic_channel (node_factory , bitcoind ):
3580
3580
"""Smoke test for a channel without option_static_remotekey"""
3581
- l1 , l2 = node_factory .line_graph (2 ,
3582
- opts = [{},
3583
- # needs at least 1, 7 and 15 to connect
3584
- # (and 9 is a dependent)
3585
- {'dev-force-features' : '1,7,9,15////////' }])
3581
+ l1 , l2 = node_factory .get_nodes (2 ,
3582
+ # This forces us to allow send/recv of non-static-remotekey!
3583
+ opts = {'dev-any-channel-type' : None })
3584
+ l1 .fundwallet (2000000 )
3585
+ l1 .rpc .connect (l2 .info ['id' ], 'localhost' , port = l2 .port )
3586
+ l1 .rpc .fundchannel (l2 .info ['id' ], 'all' , channel_type = [])
3587
+ bitcoind .generate_block (1 , wait_for_mempool = 1 )
3588
+
3586
3589
chan = only_one (l1 .rpc .listpeerchannels ()['channels' ])
3587
3590
assert 'option_static_remotekey' not in chan ['features' ]
3588
3591
assert 'option_anchor' not in chan ['features' ]
3589
3592
assert 'option_anchors_zero_fee_htlc_tx' not in chan ['features' ]
3593
+ wait_for (lambda : only_one (l1 .rpc .listpeerchannels ()['channels' ])['state' ] == 'CHANNELD_NORMAL' )
3590
3594
3591
3595
l1 .pay (l2 , 1000 )
3592
3596
l1 .rpc .close (l2 .info ['id' ])
@@ -3693,12 +3697,20 @@ def test_openchannel_init_alternate(node_factory, executor):
3693
3697
3694
3698
def test_upgrade_statickey (node_factory , executor ):
3695
3699
"""l1 doesn't have option_static_remotekey, l2 offers it."""
3696
- l1 , l2 = node_factory .line_graph (2 , opts = [{'may_reconnect' : True ,
3697
- 'dev-force-features' : ["-13" ],
3698
- 'experimental-upgrade-protocol' : None },
3699
- {'may_reconnect' : True ,
3700
- 'experimental-upgrade-protocol' : None }])
3700
+ l1 , l2 = node_factory .get_nodes (2 , opts = [{'may_reconnect' : True ,
3701
+ 'experimental-upgrade-protocol' : None ,
3702
+ # This forces us to allow sending non-static-remotekey!
3703
+ 'dev-any-channel-type' : None },
3704
+ {'may_reconnect' : True ,
3705
+ # This forces us to accept non-static-remotekey!
3706
+ 'dev-any-channel-type' : None ,
3707
+ 'experimental-upgrade-protocol' : None }])
3701
3708
3709
+ l1 .fundwallet (2000000 )
3710
+ l1 .rpc .connect (l2 .info ['id' ], 'localhost' , port = l2 .port )
3711
+ l1 .rpc .fundchannel (l2 .info ['id' ], 'all' , channel_type = [])
3712
+
3713
+ # Now reconnect.
3702
3714
l1 .rpc .disconnect (l2 .info ['id' ], force = True )
3703
3715
l1 .rpc .connect (l2 .info ['id' ], 'localhost' , l2 .port )
3704
3716
@@ -3723,15 +3735,22 @@ def test_upgrade_statickey(node_factory, executor):
3723
3735
3724
3736
def test_upgrade_statickey_onchaind (node_factory , executor , bitcoind ):
3725
3737
"""We test penalty before/after, and unilateral before/after"""
3726
- l1 , l2 = node_factory .line_graph (2 , opts = [{'may_reconnect' : True ,
3727
- 'dev-no-reconnect' : None ,
3728
- 'dev-force-features' : ["-13" ],
3729
- 'experimental-upgrade-protocol' : None ,
3730
- # We try to cheat!
3731
- 'allow_broken_log' : True },
3732
- {'may_reconnect' : True ,
3733
- 'dev-no-reconnect' : None ,
3734
- 'experimental-upgrade-protocol' : None }])
3738
+ l1 , l2 = node_factory .get_nodes (2 , opts = [{'may_reconnect' : True ,
3739
+ 'experimental-upgrade-protocol' : None ,
3740
+ # This forces us to allow sending non-static-remotekey!
3741
+ 'dev-any-channel-type' : None ,
3742
+ # We try to cheat!
3743
+ 'allow_broken_log' : True },
3744
+ {'may_reconnect' : True ,
3745
+ # This forces us to allow non-static-remotekey!
3746
+ 'dev-any-channel-type' : None ,
3747
+ 'experimental-upgrade-protocol' : None }])
3748
+
3749
+ l1 .fundwallet (FUNDAMOUNT + 1000 )
3750
+ l1 .rpc .connect (l2 .info ['id' ], 'localhost' , port = l2 .port )
3751
+ l1 .rpc .fundchannel (l2 .info ['id' ], 'all' , channel_type = [])
3752
+ bitcoind .generate_block (1 , wait_for_mempool = 1 )
3753
+ wait_for (lambda : only_one (l1 .rpc .listpeerchannels ()['channels' ])['state' ] == 'CHANNELD_NORMAL' )
3735
3754
3736
3755
# TEST 1: Cheat from pre-upgrade.
3737
3756
tx = l1 .rpc .dev_sign_last_tx (l2 .info ['id' ])['tx' ]
@@ -3769,12 +3788,17 @@ def test_upgrade_statickey_onchaind(node_factory, executor, bitcoind):
3769
3788
wait_for (lambda : l2 .rpc .listpeerchannels ()['channels' ] == [])
3770
3789
3771
3790
# TEST 2: Cheat from post-upgrade.
3772
- node_factory .join_nodes ([l1 , l2 ])
3791
+ l1 .fundwallet (FUNDAMOUNT + 1000 )
3792
+ l1 .rpc .connect (l2 .info ['id' ], 'localhost' , port = l2 .port )
3793
+ l1 .rpc .fundchannel (l2 .info ['id' ], 'all' , channel_type = [])
3794
+
3773
3795
l1 .rpc .disconnect (l2 .info ['id' ], force = True )
3774
3796
l1 .rpc .connect (l2 .info ['id' ], 'localhost' , l2 .port )
3775
3797
3776
3798
l1 .daemon .wait_for_log ('option_static_remotekey enabled at 1/1' )
3777
3799
l2 .daemon .wait_for_log ('option_static_remotekey enabled at 1/1' )
3800
+ bitcoind .generate_block (1 , wait_for_mempool = 1 )
3801
+ wait_for (lambda : only_one (l1 .rpc .listpeerchannels ()['channels' ])['state' ] == 'CHANNELD_NORMAL' )
3778
3802
3779
3803
l1 .pay (l2 , 1000000 )
3780
3804
@@ -3796,7 +3820,11 @@ def test_upgrade_statickey_onchaind(node_factory, executor, bitcoind):
3796
3820
wait_for (lambda : len (l2 .rpc .listpeerchannels ()['channels' ]) == 0 )
3797
3821
3798
3822
# TEST 3: Unilateral close from pre-upgrade
3799
- node_factory .join_nodes ([l1 , l2 ])
3823
+ l1 .rpc .connect (l2 .info ['id' ], 'localhost' , port = l2 .port )
3824
+ l1 .fundwallet (FUNDAMOUNT + 1000 )
3825
+ l1 .rpc .fundchannel (l2 .info ['id' ], 'all' , channel_type = [])
3826
+ bitcoind .generate_block (1 , wait_for_mempool = 1 )
3827
+ wait_for (lambda : only_one (l1 .rpc .listpeerchannels ()['channels' ])['state' ] == 'CHANNELD_NORMAL' )
3800
3828
3801
3829
# Give them both something for onchain close.
3802
3830
l1 .pay (l2 , 1000000 )
@@ -3827,12 +3855,16 @@ def test_upgrade_statickey_onchaind(node_factory, executor, bitcoind):
3827
3855
wait_for (lambda : len (l2 .rpc .listpeerchannels ()['channels' ]) == 0 )
3828
3856
3829
3857
# TEST 4: Unilateral close from post-upgrade
3830
- node_factory .join_nodes ([l1 , l2 ])
3858
+ l1 .rpc .connect (l2 .info ['id' ], 'localhost' , port = l2 .port )
3859
+ l1 .rpc .fundchannel (l2 .info ['id' ], 'all' , channel_type = [])
3831
3860
3832
3861
l1 .rpc .disconnect (l2 .info ['id' ], force = True )
3833
3862
l1 .rpc .connect (l2 .info ['id' ], 'localhost' , l2 .port )
3834
3863
l1 .daemon .wait_for_log ('option_static_remotekey enabled at 1/1' )
3835
3864
3865
+ bitcoind .generate_block (1 , wait_for_mempool = 1 )
3866
+ wait_for (lambda : only_one (l1 .rpc .listpeerchannels ()['channels' ])['state' ] == 'CHANNELD_NORMAL' )
3867
+
3836
3868
# Move to static_remotekey.
3837
3869
l1 .pay (l2 , 1000000 )
3838
3870
@@ -3862,20 +3894,28 @@ def test_upgrade_statickey_fail(node_factory, executor, bitcoind):
3862
3894
l2_disconnects = ['-WIRE_REVOKE_AND_ACK' ,
3863
3895
'-WIRE_COMMITMENT_SIGNED' ]
3864
3896
3865
- l1 , l2 = node_factory .line_graph (2 , opts = [{'may_reconnect' : True ,
3866
- 'dev-no-reconnect' : None ,
3867
- 'disconnect' : l1_disconnects ,
3868
- 'experimental-upgrade-protocol' : None ,
3869
- 'dev-force-features' : ["-13" ],
3870
- # Don't have feerate changes!
3871
- 'feerates' : (7500 , 7500 , 7500 , 7500 )},
3872
- {'may_reconnect' : True ,
3873
- 'dev-no-reconnect' : None ,
3874
- 'experimental-upgrade-protocol' : None ,
3875
- 'disconnect' : l2_disconnects ,
3876
- 'plugin' : os .path .join (os .getcwd (), 'tests/plugins/hold_htlcs.py' ),
3877
- 'hold-time' : 10000 ,
3878
- 'hold-result' : 'fail' }])
3897
+ l1 , l2 = node_factory .get_nodes (2 , opts = [{'may_reconnect' : True ,
3898
+ 'dev-no-reconnect' : None ,
3899
+ 'disconnect' : l1_disconnects ,
3900
+ # This allows us to send non-static-remotekey!
3901
+ 'dev-any-channel-type' : None ,
3902
+ 'experimental-upgrade-protocol' : None ,
3903
+ # Don't have feerate changes!
3904
+ 'feerates' : (7500 , 7500 , 7500 , 7500 )},
3905
+ {'may_reconnect' : True ,
3906
+ 'dev-no-reconnect' : None ,
3907
+ 'experimental-upgrade-protocol' : None ,
3908
+ # This forces us to accept non-static-remotekey!
3909
+ 'dev-any-channel-type' : None ,
3910
+ 'disconnect' : l2_disconnects ,
3911
+ 'plugin' : os .path .join (os .getcwd (), 'tests/plugins/hold_htlcs.py' ),
3912
+ 'hold-time' : 10000 ,
3913
+ 'hold-result' : 'fail' }])
3914
+ l1 .fundwallet (FUNDAMOUNT + 1000 )
3915
+ l1 .rpc .connect (l2 .info ['id' ], 'localhost' , port = l2 .port )
3916
+ l1 .rpc .fundchannel (l2 .info ['id' ], 'all' , channel_type = [])
3917
+ bitcoind .generate_block (1 , wait_for_mempool = 1 )
3918
+ wait_for (lambda : only_one (l1 .rpc .listpeerchannels ()['channels' ])['state' ] == 'CHANNELD_NORMAL' )
3879
3919
3880
3920
# This HTLC will fail
3881
3921
l1 .rpc .sendpay ([{'amount_msat' : 1000 , 'id' : l2 .info ['id' ], 'delay' : 5 , 'channel' : first_scid (l1 , l2 )}], '00' * 32 , payment_secret = '00' * 32 )
0 commit comments