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