Skip to content

Commit 1aa5bbc

Browse files
committed
pytest: remove channel upgrade tests.
We removed the functionality, but only disabled the tests. Signed-off-by: Rusty Russell <[email protected]>
1 parent 0f3e7d5 commit 1aa5bbc

File tree

1 file changed

+0
-272
lines changed

1 file changed

+0
-272
lines changed

tests/test_connection.py

Lines changed: 0 additions & 272 deletions
Original file line numberDiff line numberDiff line change
@@ -3729,278 +3729,6 @@ def test_openchannel_init_alternate(node_factory, executor):
37293729
print("nothing to do")
37303730

37313731

3732-
@unittest.skip("experimental-upgrade-protocol TLV fields conflict with splicing TLV fields")
3733-
def test_upgrade_statickey(node_factory, executor):
3734-
"""l1 doesn't have option_static_remotekey, l2 offers it."""
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-
{'may_reconnect': True,
3740-
# This forces us to accept non-static-remotekey!
3741-
'dev-any-channel-type': None,
3742-
'experimental-upgrade-protocol': None}])
3743-
3744-
l1.fundwallet(2000000)
3745-
l1.rpc.connect(l2.info['id'], 'localhost', port=l2.port)
3746-
l1.rpc.fundchannel(l2.info['id'], 'all', channel_type=[])
3747-
3748-
# Now reconnect.
3749-
l1.rpc.disconnect(l2.info['id'], force=True)
3750-
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
3751-
3752-
l1.daemon.wait_for_logs([r"They sent current_channel_type \[\]",
3753-
r"They offered upgrade to \[12\]"])
3754-
l2.daemon.wait_for_log(r"They sent desired_channel_type \[12\]")
3755-
3756-
l1.daemon.wait_for_log('option_static_remotekey enabled at 1/1')
3757-
l2.daemon.wait_for_log('option_static_remotekey enabled at 1/1')
3758-
3759-
# Make sure it's committed to db!
3760-
wait_for(lambda: l1.db_query('SELECT local_static_remotekey_start, remote_static_remotekey_start FROM channels;') == [{'local_static_remotekey_start': 1, 'remote_static_remotekey_start': 1}])
3761-
3762-
# They will consider themselves upgraded.
3763-
l1.rpc.disconnect(l2.info['id'], force=True)
3764-
# They won't offer upgrade!
3765-
assert not l1.daemon.is_in_log("They offered upgrade",
3766-
start=l1.daemon.logsearch_start)
3767-
l1.daemon.wait_for_log(r"They sent current_channel_type \[12\]")
3768-
l2.daemon.wait_for_log(r"They sent desired_channel_type \[12\]")
3769-
3770-
3771-
@unittest.skip("experimental-upgrade-protocol TLV fields conflict with splicing TLV fields")
3772-
def test_upgrade_statickey_onchaind(node_factory, executor, bitcoind):
3773-
"""We test penalty before/after, and unilateral before/after"""
3774-
l1, l2 = node_factory.get_nodes(2, opts=[{'may_reconnect': True,
3775-
'experimental-upgrade-protocol': None,
3776-
# This forces us to allow sending non-static-remotekey!
3777-
'dev-any-channel-type': None,
3778-
# We try to cheat!
3779-
'broken_log': r"onchaind-chan#[0-9]*: Could not find resolution for output .*: did \*we\* cheat\?"},
3780-
{'may_reconnect': True,
3781-
# This forces us to allow non-static-remotekey!
3782-
'dev-any-channel-type': None,
3783-
'experimental-upgrade-protocol': None}])
3784-
3785-
l1.fundwallet(FUNDAMOUNT + 1000)
3786-
l1.rpc.connect(l2.info['id'], 'localhost', port=l2.port)
3787-
l1.rpc.fundchannel(l2.info['id'], 'all', channel_type=[])
3788-
bitcoind.generate_block(1, wait_for_mempool=1)
3789-
wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['state'] == 'CHANNELD_NORMAL')
3790-
3791-
# TEST 1: Cheat from pre-upgrade.
3792-
tx = l1.rpc.dev_sign_last_tx(l2.info['id'])['tx']
3793-
3794-
l1.rpc.disconnect(l2.info['id'], force=True)
3795-
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
3796-
l1.daemon.wait_for_log('option_static_remotekey enabled at 1/1')
3797-
3798-
# Make sure another commitment happens, sending failed payment.
3799-
routestep = {
3800-
'amount_msat': 1,
3801-
'id': l2.info['id'],
3802-
'delay': 5,
3803-
'channel': first_scid(l1, l2)
3804-
}
3805-
l1.rpc.sendpay([routestep], '00' * 32, payment_secret='00' * 32)
3806-
with pytest.raises(RpcError, match=r'WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS'):
3807-
l1.rpc.waitsendpay('00' * 32)
3808-
3809-
# Make sure l2 gets REVOKE_AND_ACK from previous.
3810-
l2.daemon.wait_for_log('peer_in WIRE_UPDATE_ADD_HTLC')
3811-
l2.daemon.wait_for_log('peer_out WIRE_REVOKE_AND_ACK')
3812-
l2.daemon.wait_for_log('peer_in WIRE_REVOKE_AND_ACK')
3813-
3814-
# Pre-statickey penalty works.
3815-
bitcoind.rpc.sendrawtransaction(tx)
3816-
bitcoind.generate_block(1)
3817-
3818-
_, txid, blocks = l2.wait_for_onchaind_tx('OUR_PENALTY_TX',
3819-
'THEIR_REVOKED_UNILATERAL/DELAYED_CHEAT_OUTPUT_TO_THEM')
3820-
assert blocks == 0
3821-
3822-
bitcoind.generate_block(100, wait_for_mempool=txid)
3823-
# This works even if they disconnect and listpeerchannels() is empty:
3824-
wait_for(lambda: l1.rpc.listpeerchannels()['channels'] == [])
3825-
wait_for(lambda: l2.rpc.listpeerchannels()['channels'] == [])
3826-
3827-
# TEST 2: Cheat from post-upgrade.
3828-
l1.fundwallet(FUNDAMOUNT + 1000)
3829-
l1.rpc.connect(l2.info['id'], 'localhost', port=l2.port)
3830-
l1.rpc.fundchannel(l2.info['id'], 'all', channel_type=[])
3831-
3832-
l1.rpc.disconnect(l2.info['id'], force=True)
3833-
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
3834-
3835-
l1.daemon.wait_for_log('option_static_remotekey enabled at 1/1')
3836-
l2.daemon.wait_for_log('option_static_remotekey enabled at 1/1')
3837-
bitcoind.generate_block(1, wait_for_mempool=1)
3838-
wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['state'] == 'CHANNELD_NORMAL')
3839-
3840-
l1.pay(l2, 1000000)
3841-
3842-
# We will try to cheat later.
3843-
tx = l1.rpc.dev_sign_last_tx(l2.info['id'])['tx']
3844-
3845-
l1.pay(l2, 1000000)
3846-
3847-
# Pre-statickey penalty works.
3848-
bitcoind.rpc.sendrawtransaction(tx)
3849-
bitcoind.generate_block(1)
3850-
3851-
_, txid, blocks = l2.wait_for_onchaind_tx('OUR_PENALTY_TX',
3852-
'THEIR_REVOKED_UNILATERAL/DELAYED_CHEAT_OUTPUT_TO_THEM')
3853-
assert blocks == 0
3854-
3855-
bitcoind.generate_block(100, wait_for_mempool=txid)
3856-
# This works even if they disconnect and listpeers() is empty:
3857-
wait_for(lambda: len(l1.rpc.listpeerchannels()['channels']) == 0)
3858-
wait_for(lambda: len(l2.rpc.listpeerchannels()['channels']) == 0)
3859-
3860-
# TEST 3: Unilateral close from pre-upgrade
3861-
l1.rpc.connect(l2.info['id'], 'localhost', port=l2.port)
3862-
l1.fundwallet(FUNDAMOUNT + 1000)
3863-
l1.rpc.fundchannel(l2.info['id'], 'all', channel_type=[])
3864-
bitcoind.generate_block(1, wait_for_mempool=1)
3865-
wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['state'] == 'CHANNELD_NORMAL')
3866-
3867-
# Give them both something for onchain close.
3868-
l1.pay(l2, 1000000)
3869-
3870-
# Make sure it's completely quiescent.
3871-
l1.daemon.wait_for_log("chan#3: Removing out HTLC 0 state RCVD_REMOVE_ACK_REVOCATION FULFILLED")
3872-
3873-
l1.rpc.disconnect(l2.info['id'], force=True)
3874-
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
3875-
l1.daemon.wait_for_log('option_static_remotekey enabled at 3/3')
3876-
3877-
# But this is the *pre*-update commit tx!
3878-
l2.stop()
3879-
l1.rpc.close(l2.info['id'], unilateraltimeout=1)
3880-
bitcoind.generate_block(1, wait_for_mempool=1)
3881-
l2.start()
3882-
3883-
# They should both handle it fine.
3884-
_, txid, blocks = l1.wait_for_onchaind_tx('OUR_DELAYED_RETURN_TO_WALLET',
3885-
'OUR_UNILATERAL/DELAYED_OUTPUT_TO_US')
3886-
assert blocks == 4
3887-
l2.daemon.wait_for_logs(['Ignoring output .*: THEIR_UNILATERAL/OUTPUT_TO_US',
3888-
'Ignoring output .*: THEIR_UNILATERAL/DELAYED_OUTPUT_TO_THEM'])
3889-
bitcoind.generate_block(4)
3890-
bitcoind.generate_block(100, wait_for_mempool=txid)
3891-
3892-
# This works even if they disconnect and listpeerchannels() is empty:
3893-
wait_for(lambda: len(l1.rpc.listpeerchannels()['channels']) == 0)
3894-
wait_for(lambda: len(l2.rpc.listpeerchannels()['channels']) == 0)
3895-
3896-
# TEST 4: Unilateral close from post-upgrade
3897-
l1.rpc.connect(l2.info['id'], 'localhost', port=l2.port)
3898-
l1.rpc.fundchannel(l2.info['id'], 'all', channel_type=[])
3899-
3900-
l1.rpc.disconnect(l2.info['id'], force=True)
3901-
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
3902-
l1.daemon.wait_for_log('option_static_remotekey enabled at 1/1')
3903-
3904-
bitcoind.generate_block(1, wait_for_mempool=1)
3905-
wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['state'] == 'CHANNELD_NORMAL')
3906-
3907-
# Move to static_remotekey.
3908-
l1.pay(l2, 1000000)
3909-
3910-
l2.stop()
3911-
l1.rpc.close(l2.info['id'], unilateraltimeout=1)
3912-
bitcoind.generate_block(1, wait_for_mempool=1)
3913-
l2.start()
3914-
3915-
# They should both handle it fine.
3916-
_, txid, blocks = l1.wait_for_onchaind_tx('OUR_DELAYED_RETURN_TO_WALLET',
3917-
'OUR_UNILATERAL/DELAYED_OUTPUT_TO_US')
3918-
assert blocks == 4
3919-
l2.daemon.wait_for_logs(['Ignoring output .*: THEIR_UNILATERAL/OUTPUT_TO_US',
3920-
'Ignoring output .*: THEIR_UNILATERAL/DELAYED_OUTPUT_TO_THEM'])
3921-
3922-
bitcoind.generate_block(4)
3923-
bitcoind.generate_block(100, wait_for_mempool=txid)
3924-
3925-
# This works even if they disconnect and listpeerchannels() is empty:
3926-
wait_for(lambda: len(l2.rpc.listpeerchannels()['channels']) == 0)
3927-
3928-
3929-
@unittest.skip("experimental-upgrade-protocol TLV fields conflict with splicing TLV fields")
3930-
def test_upgrade_statickey_fail(node_factory, executor, bitcoind):
3931-
"""We reconnect at all points during retransmit, and we won't upgrade."""
3932-
l1_disconnects = ['-WIRE_COMMITMENT_SIGNED',
3933-
'-WIRE_REVOKE_AND_ACK']
3934-
l2_disconnects = ['-WIRE_REVOKE_AND_ACK',
3935-
'-WIRE_COMMITMENT_SIGNED']
3936-
3937-
l1, l2 = node_factory.get_nodes(2, opts=[{'may_reconnect': True,
3938-
'dev-no-reconnect': None,
3939-
'disconnect': l1_disconnects,
3940-
# This allows us to send non-static-remotekey!
3941-
'dev-any-channel-type': None,
3942-
'experimental-upgrade-protocol': None,
3943-
# Don't have feerate changes!
3944-
'feerates': (7500, 7500, 7500, 7500)},
3945-
{'may_reconnect': True,
3946-
'dev-no-reconnect': None,
3947-
'experimental-upgrade-protocol': None,
3948-
# This forces us to accept non-static-remotekey!
3949-
'dev-any-channel-type': None,
3950-
'disconnect': l2_disconnects,
3951-
'plugin': os.path.join(os.getcwd(), 'tests/plugins/hold_htlcs.py'),
3952-
'hold-time': 10000,
3953-
'hold-result': 'fail'}])
3954-
l1.fundwallet(FUNDAMOUNT + 1000)
3955-
l1.rpc.connect(l2.info['id'], 'localhost', port=l2.port)
3956-
l1.rpc.fundchannel(l2.info['id'], 'all', channel_type=[])
3957-
bitcoind.generate_block(1, wait_for_mempool=1)
3958-
wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['state'] == 'CHANNELD_NORMAL')
3959-
3960-
# This HTLC will fail
3961-
l1.rpc.sendpay([{'amount_msat': 1000, 'id': l2.info['id'], 'delay': 5, 'channel': first_scid(l1, l2)}], '00' * 32, payment_secret='00' * 32)
3962-
3963-
# Each one should cause one disconnection, no upgrade.
3964-
for d in l1_disconnects + l2_disconnects:
3965-
l1.daemon.wait_for_log('Peer connection lost')
3966-
l2.daemon.wait_for_log('Peer connection lost')
3967-
assert not l1.daemon.is_in_log('option_static_remotekey enabled')
3968-
assert not l2.daemon.is_in_log('option_static_remotekey enabled')
3969-
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
3970-
line1 = l1.daemon.wait_for_log('No upgrade')
3971-
line2 = l2.daemon.wait_for_log('No upgrade')
3972-
3973-
# On the last reconnect, it retransmitted revoke_and_ack.
3974-
assert re.search('No upgrade: we retransmitted', line1)
3975-
assert re.search('No upgrade: pending changes', line2)
3976-
3977-
# Make sure we already skip the first of these.
3978-
l1.daemon.wait_for_log('billboard perm: Reconnected, and reestablished.')
3979-
assert 'option_static_remotekey' not in only_one(l1.rpc.listpeerchannels()['channels'])['features']
3980-
assert 'option_static_remotekey' not in only_one(l2.rpc.listpeerchannels()['channels'])['features']
3981-
3982-
sleeptime = 1
3983-
while True:
3984-
# Now when we reconnect, despite having an HTLC, we're quiescent.
3985-
l1.rpc.disconnect(l2.info['id'], force=True)
3986-
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
3987-
3988-
oldstart = l1.daemon.logsearch_start
3989-
l1.daemon.wait_for_log('billboard perm: Reconnected, and reestablished.')
3990-
if not l1.daemon.is_in_log('No upgrade:', start=oldstart):
3991-
break
3992-
3993-
# Give it some processing time before reconnect...
3994-
time.sleep(sleeptime)
3995-
sleeptime += 1
3996-
3997-
l1.daemon.logsearch_start = oldstart
3998-
assert l1.daemon.wait_for_log('option_static_remotekey enabled at 2/2')
3999-
assert l2.daemon.wait_for_log('option_static_remotekey enabled at 2/2')
4000-
assert 'option_static_remotekey' in only_one(l1.rpc.listpeerchannels()['channels'])['features']
4001-
assert 'option_static_remotekey' in only_one(l2.rpc.listpeerchannels()['channels'])['features']
4002-
4003-
40043732
def test_quiescence(node_factory, executor):
40053733
l1, l2 = node_factory.line_graph(2)
40063734

0 commit comments

Comments
 (0)