tests: explicitly mark tests to run both as v1+v2

By default, tests only run as v1 unless marked as v2.

These tests we want to run as both v1+v2

Includes fixes to have tests pass
This commit is contained in:
niftynei 2021-05-07 13:39:23 -05:00 committed by Rusty Russell
parent dc758f616b
commit 558abe288a
5 changed files with 157 additions and 15 deletions

View File

@ -149,6 +149,8 @@ def test_balance(node_factory):
assert p2['msatoshi_total'] == 10**6 * 1000
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_bad_opening(node_factory):
# l1 asks for a too-long locktime
l1 = node_factory.get_node(options={'watchtime-blocks': 100})
@ -170,6 +172,8 @@ def test_bad_opening(node_factory):
@pytest.mark.developer("gossip without DEVELOPER=1 is slow")
@unittest.skipIf(TEST_NETWORK != 'regtest', "Fee computation and limits are network specific")
@pytest.mark.slow_test
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_opening_tiny_channel(node_factory):
# Test custom min-capacity-sat parameters
#
@ -200,31 +204,36 @@ def test_opening_tiny_channel(node_factory):
l3_min_capacity = 10000 # the current default
l4_min_capacity = 20000 # a server with more than default minimum
l1, l2, l3, l4 = node_factory.get_nodes(4, opts=[{'min-capacity-sat': 0},
{'min-capacity-sat': l2_min_capacity},
{'min-capacity-sat': l3_min_capacity},
{'min-capacity-sat': l4_min_capacity}])
opts = [{'min-capacity-sat': 0},
{'min-capacity-sat': l2_min_capacity},
{'min-capacity-sat': l3_min_capacity},
{'min-capacity-sat': l4_min_capacity}]
l1, l2, l3, l4 = node_factory.get_nodes(4, opts=opts)
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
l1.rpc.connect(l3.info['id'], 'localhost', l3.port)
l1.rpc.connect(l4.info['id'], 'localhost', l4.port)
with pytest.raises(RpcError, match=r'They sent error.*channel capacity is .*, which is below .*msat'):
with pytest.raises(RpcError, match=r'They sent [error|warning].*channel capacity is .*, which is below .*msat'):
l1.fundchannel(l2, l2_min_capacity + overhead - 1)
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
l1.fundchannel(l2, l2_min_capacity + overhead)
with pytest.raises(RpcError, match=r'They sent error.*channel capacity is .*, which is below .*msat'):
with pytest.raises(RpcError, match=r'They sent [error|warning].*channel capacity is .*, which is below .*msat'):
l1.fundchannel(l3, l3_min_capacity + overhead - 1)
l1.rpc.connect(l3.info['id'], 'localhost', l3.port)
l1.fundchannel(l3, l3_min_capacity + overhead)
with pytest.raises(RpcError, match=r'They sent error.*channel capacity is .*, which is below .*msat'):
with pytest.raises(RpcError, match=r'They sent [error|warning].*channel capacity is .*, which is below .*msat'):
l1.fundchannel(l4, l4_min_capacity + overhead - 1)
l1.rpc.connect(l4.info['id'], 'localhost', l4.port)
l1.fundchannel(l4, l4_min_capacity + overhead)
# Note that this check applies locally too, so you can't open it if
# you would reject it.
l3.rpc.connect(l2.info['id'], 'localhost', l2.port)
with pytest.raises(RpcError, match=r"'message': 'channel capacity.* is .*, which is below .*msat"):
with pytest.raises(RpcError, match=r"channel capacity is .*, which is below .*msat"):
l3.fundchannel(l2, l3_min_capacity + overhead - 1)
l3.rpc.connect(l2.info['id'], 'localhost', l2.port)
l3.fundchannel(l2, l3_min_capacity + overhead)
@ -238,6 +247,8 @@ def test_second_channel(node_factory):
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_disconnect(node_factory):
# These should all make us fail
disconnects = ['-WIRE_INIT',
@ -264,6 +275,8 @@ def test_disconnect(node_factory):
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_disconnect_opener(node_factory):
# Now error on opener side during channel open.
disconnects = ['-WIRE_OPEN_CHANNEL',
@ -306,6 +319,8 @@ def test_disconnect_opener(node_factory):
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_disconnect_fundee(node_factory):
# Now error on fundee side during channel open.
disconnects = ['-WIRE_ACCEPT_CHANNEL',
@ -382,6 +397,8 @@ def test_disconnect_fundee_v2(node_factory):
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_disconnect_half_signed(node_factory):
# Now, these are the corner cases. Fundee sends funding_signed,
# but opener doesn't receive it.
@ -403,6 +420,8 @@ def test_disconnect_half_signed(node_factory):
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_reconnect_signed(node_factory):
# This will fail *after* both sides consider channel opening.
disconnects = ['+WIRE_FUNDING_SIGNED']
@ -437,6 +456,8 @@ def test_reconnect_signed(node_factory):
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_reconnect_openingd(node_factory):
# Openingd thinks we're still opening; opener reconnects..
disconnects = ['0WIRE_ACCEPT_CHANNEL']
@ -460,7 +481,10 @@ def test_reconnect_openingd(node_factory):
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
# We should get a message about reconnecting.
l2.daemon.wait_for_log('Killing opening daemon: Reconnected')
if l2.config('experimental-dual-fund'):
l2.daemon.wait_for_log('Killing dualopend: Reconnected')
else:
l2.daemon.wait_for_log('Killing opening daemon: Reconnected')
l2.daemon.wait_for_log('Handed peer, entering loop')
# Should work fine.
@ -493,6 +517,8 @@ def test_reconnect_gossiping(node_factory):
@flaky
@pytest.mark.developer("needs dev-disconnect")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_reconnect_no_update(node_factory, executor, bitcoind):
"""Test that funding_locked is retransmitted on reconnect if new channel
@ -578,6 +604,8 @@ def test_connect_stresstest(node_factory, executor):
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_reconnect_normal(node_factory):
# Should reconnect fine even if locked message gets lost.
disconnects = ['-WIRE_FUNDING_LOCKED',
@ -592,6 +620,8 @@ def test_reconnect_normal(node_factory):
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_reconnect_sender_add1(node_factory):
# Fail after add is OK, will cause payment failure though.
disconnects = ['-WIRE_UPDATE_ADD_HTLC-nocommit',
@ -614,8 +644,8 @@ def test_reconnect_sender_add1(node_factory):
route = [{'msatoshi': amt, 'id': l2.info['id'], 'delay': 5, 'channel': '1x1x1'}]
for i in range(0, len(disconnects)):
l1.rpc.sendpay(route, rhash)
with pytest.raises(RpcError):
l1.rpc.sendpay(route, rhash)
l1.rpc.waitsendpay(rhash)
# Wait for reconnection.
@ -626,6 +656,8 @@ def test_reconnect_sender_add1(node_factory):
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_reconnect_sender_add(node_factory):
disconnects = ['-WIRE_COMMITMENT_SIGNED',
'@WIRE_COMMITMENT_SIGNED',
@ -659,6 +691,8 @@ def test_reconnect_sender_add(node_factory):
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_reconnect_receiver_add(node_factory):
disconnects = ['-WIRE_COMMITMENT_SIGNED',
'@WIRE_COMMITMENT_SIGNED',
@ -723,6 +757,8 @@ def test_reconnect_receiver_fulfill(node_factory):
@flaky
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_shutdown_reconnect(node_factory):
disconnects = ['-WIRE_SHUTDOWN',
'@WIRE_SHUTDOWN',
@ -786,6 +822,8 @@ def test_reconnect_remote_sends_no_sigs(node_factory):
assert(''.join(l1.daemon.logs).count(r'peer_out WIRE_ANNOUNCEMENT_SIGNATURES') == 1)
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_shutdown_awaiting_lockin(node_factory, bitcoind):
l1 = node_factory.get_node()
l2 = node_factory.get_node(options={'funding-confirms': 3})
@ -823,6 +861,8 @@ def test_shutdown_awaiting_lockin(node_factory, bitcoind):
wait_for(lambda: l2.rpc.listpeers()['peers'] == [])
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_funding_change(node_factory, bitcoind):
"""Add some funds, fund a channel, and make sure we remember the change
"""
@ -845,6 +885,8 @@ def test_funding_change(node_factory, bitcoind):
assert outputs[2] == 10000000
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_funding_all(node_factory, bitcoind):
"""Add some funds, fund a channel using all funds, make sure no funds remain
"""
@ -863,6 +905,8 @@ def test_funding_all(node_factory, bitcoind):
assert len(outputs) == 0
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_funding_all_too_much(node_factory):
"""Add more than max possible funds, fund a channel using all funds we can.
"""
@ -886,6 +930,8 @@ def test_funding_all_too_much(node_factory):
assert only_one(l1.rpc.listfunds()['channels'])['channel_total_sat'] == 2**24 - 1
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_funding_fail(node_factory, bitcoind):
"""Add some funds, fund a channel without enough funds"""
# Previous runs with same bitcoind can leave funds!
@ -907,8 +953,13 @@ def test_funding_fail(node_factory, bitcoind):
with pytest.raises(RpcError, match=r'to_self_delay \d+ larger than \d+'):
l1.rpc.fundchannel(l2.info['id'], int(funds / 10))
assert only_one(l1.rpc.listpeers()['peers'])['connected']
assert only_one(l2.rpc.listpeers()['peers'])['connected']
# dual-funded channels disconnect on failure
if not l1.config('experimental-dual-fund'):
assert only_one(l1.rpc.listpeers()['peers'])['connected']
assert only_one(l2.rpc.listpeers()['peers'])['connected']
else:
assert len(l1.rpc.listpeers()['peers']) == 0
assert len(l2.rpc.listpeers()['peers']) == 0
# Restart l2 without ridiculous locktime.
del l2.daemon.opts['watchtime-blocks']
@ -919,7 +970,7 @@ def test_funding_fail(node_factory, bitcoind):
with pytest.raises(RpcError, match=r'not afford'):
l1.rpc.fundchannel(l2.info['id'], funds)
# Should still be connected.
# Should still be connected (we didn't contact the peer)
assert only_one(l1.rpc.listpeers()['peers'])['connected']
l2.daemon.wait_for_log('Handed peer, entering loop')
assert only_one(l2.rpc.listpeers()['peers'])['connected']
@ -928,6 +979,8 @@ def test_funding_fail(node_factory, bitcoind):
l1.rpc.fundchannel(l2.info['id'], int(funds / 10))
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_funding_toolarge(node_factory, bitcoind):
"""Try to create a giant channel"""
l1 = node_factory.get_node()
@ -976,6 +1029,7 @@ def test_v2_open(node_factory, bitcoind, chainparams):
assert(result['status'] == 'complete')
@pytest.mark.openchannel('v1')
def test_funding_push(node_factory, bitcoind, chainparams):
""" Try to push peer some sats """
# We track balances, to verify that accounting is ok.
@ -1020,6 +1074,8 @@ def test_funding_push(node_factory, bitcoind, chainparams):
assert account_balance(l1, chanid) == (amount - push_sat) * 1000
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_funding_by_utxos(node_factory, bitcoind):
"""Fund a channel with specific utxos"""
l1, l2, l3 = node_factory.line_graph(3, fundchannel=False)
@ -1256,6 +1312,8 @@ def test_funding_cancel_race(node_factory, bitcoind, executor):
executor.map(lambda n: n.stop(), node_factory.nodes)
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
@unittest.skipIf(TEST_NETWORK != 'regtest', "External wallet support doesn't work with elements yet.")
def test_funding_close_upfront(node_factory, bitcoind):
opts = {'plugin': os.path.join(os.getcwd(), 'tests/plugins/openchannel_hook_accepter.py')}
@ -1483,6 +1541,8 @@ def test_multifunding_v2_exclusive(node_factory, bitcoind):
l1.rpc.pay(inv)
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_multifunding_simple(node_factory, bitcoind):
'''
Simple test for multifundchannel.
@ -1509,6 +1569,8 @@ def test_multifunding_simple(node_factory, bitcoind):
l1.rpc.pay(inv)
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_multifunding_one(node_factory, bitcoind):
'''
Test that multifunding can still fund to one destination.
@ -1541,6 +1603,7 @@ def test_multifunding_one(node_factory, bitcoind):
@pytest.mark.developer("needs dev-disconnect")
@pytest.mark.openchannel('v1')
def test_multifunding_disconnect(node_factory):
'''
Test disconnection during multifundchannel
@ -1592,6 +1655,8 @@ def test_multifunding_disconnect(node_factory):
l1.rpc.multifundchannel(destinations)
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_multifunding_wumbo(node_factory):
'''
Test wumbo channel imposition in multifundchannel.
@ -1621,6 +1686,7 @@ def test_multifunding_wumbo(node_factory):
@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "Fees on elements are different")
@pytest.mark.developer("uses dev-fail")
@pytest.mark.openchannel('v1') # v2 the weight calculation is off by 3
def test_multifunding_feerates(node_factory, bitcoind):
'''
Test feerate parameters for multifundchannel
@ -1724,6 +1790,7 @@ def test_multifunding_param_failures(node_factory):
l1.rpc.multifundchannel(destinations)
@pytest.mark.openchannel('v1')
@pytest.mark.developer("disconnect=... needs DEVELOPER=1")
def test_multifunding_best_effort(node_factory, bitcoind):
'''
@ -1796,6 +1863,8 @@ def test_multifunding_best_effort(node_factory, bitcoind):
l1.rpc.multifundchannel(destinations, minchannels=1)
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_lockin_between_restart(node_factory, bitcoind):
l1 = node_factory.get_node(may_reconnect=True)
l2 = node_factory.get_node(options={'funding-confirms': 3},
@ -1819,6 +1888,8 @@ def test_lockin_between_restart(node_factory, bitcoind):
l2.daemon.wait_for_log(' to CHANNELD_NORMAL')
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_funding_while_offline(node_factory, bitcoind):
l1 = node_factory.get_node()
addr = l1.rpc.newaddr()['bech32']
@ -1841,6 +1912,8 @@ def test_funding_while_offline(node_factory, bitcoind):
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_channel_persistence(node_factory, bitcoind, executor):
# Start two nodes and open a channel (to remember). l2 will
# mysteriously die while committing the first HTLC so we can
@ -1918,6 +1991,8 @@ def test_channel_persistence(node_factory, bitcoind, executor):
@pytest.mark.developer("gossip without DEVELOPER=1 is slow")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_private_channel(node_factory):
l1, l2 = node_factory.line_graph(2, announce_channels=False, wait_for_announce=False)
l3, l4 = node_factory.line_graph(2, announce_channels=True, wait_for_announce=True)
@ -2200,6 +2275,8 @@ def test_multiple_channels(node_factory):
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_forget_channel(node_factory):
l1 = node_factory.get_node()
l2 = node_factory.get_node()
@ -2228,6 +2305,8 @@ def test_forget_channel(node_factory):
assert l2.db_query("SELECT count(*) as c FROM channels;")[0]['c'] == 1
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_peerinfo(node_factory, bitcoind):
l1, l2 = node_factory.line_graph(2, fundchannel=False, opts={'may_reconnect': True})
@ -2319,6 +2398,8 @@ def test_disconnectpeer(node_factory, bitcoind):
@pytest.mark.developer("needs --dev-max-funding-unconfirmed-blocks")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_fundee_forget_funding_tx_unconfirmed(node_factory, bitcoind):
"""Test that fundee will forget the channel if
the funding tx has been unconfirmed for too long.
@ -2498,6 +2579,8 @@ def test_opener_simple_reconnect(node_factory, bitcoind):
@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "sqlite3-specific DB rollback")
@pytest.mark.developer("needs LIGHTNINGD_DEV_LOG_IO")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_dataloss_protection(node_factory, bitcoind):
l1 = node_factory.get_node(may_reconnect=True, options={'log-level': 'io'},
feerates=(7500, 7500, 7500, 7500))
@ -2757,6 +2840,8 @@ def test_restart_many_payments(node_factory, bitcoind):
@pytest.mark.developer("need dev-disconnect")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_fail_unconfirmed(node_factory, bitcoind, executor):
"""Test that if we crash with an unconfirmed connection to a known
peer, we don't have a dangling peer in db"""
@ -2857,6 +2942,8 @@ def test_fail_unconfirmed_openchannel2(node_factory, bitcoind, executor):
l1.fundchannel(l2, 200000, wait_for_active=True)
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_change_chaining(node_factory, bitcoind):
"""Test change chaining of unconfirmed fundings
@ -2997,6 +3084,8 @@ def test_pay_disconnect_stress(node_factory, executor):
fut.result()
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_wumbo_channels(node_factory, bitcoind):
l1, l2, l3 = node_factory.get_nodes(3,
opts=[{'large-channels': None},
@ -3060,6 +3149,8 @@ def test_wumbo_channels(node_factory, bitcoind):
assert Millisatoshi(amount) > Millisatoshi(str((1 << 24) - 1) + "sat")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_channel_features(node_factory, bitcoind):
l1, l2 = node_factory.line_graph(2, fundchannel=False)
@ -3107,6 +3198,7 @@ def test_nonstatic_channel(node_factory, bitcoind):
@pytest.mark.developer("need --dev-timeout-secs")
@pytest.mark.openchannel('v1')
def test_connection_timeout(node_factory):
# l1 hears nothing back after sending INIT, should time out.
l1, l2 = node_factory.get_nodes(2,

View File

@ -1027,6 +1027,8 @@ def test_gossip_store_load_amount_truncated(node_factory):
@pytest.mark.developer("Needs fast gossip propagation")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_node_reannounce(node_factory, bitcoind):
"Test that we reannounce a node when parameters change"
l1, l2 = node_factory.line_graph(2, opts={'may_reconnect': True,

View File

@ -28,6 +28,7 @@ import unittest
@pytest.mark.developer("needs --dev-disconnect")
@pytest.mark.openchannel('v1')
def test_stop_pending_fundchannel(node_factory, executor):
"""Stop the daemon while waiting for an accept_channel
@ -161,6 +162,8 @@ def test_bitcoin_ibd(node_factory, bitcoind):
assert 'warning_bitcoind_sync' not in l1.rpc.getinfo()
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_lightningd_still_loading(node_factory, bitcoind, executor):
"""Test that we recognize we haven't got all blocks from bitcoind"""
@ -1151,6 +1154,8 @@ def test_blockchaintrack(node_factory, bitcoind):
@pytest.mark.developer("needs DEVELOPER=1")
@pytest.mark.openchannel('v2')
@pytest.mark.openchannel('v1')
def test_funding_reorg_private(node_factory, bitcoind):
"""Change funding tx height after lockin, between node restart.
"""
@ -1192,6 +1197,8 @@ def test_funding_reorg_private(node_factory, bitcoind):
@pytest.mark.developer("needs DEVELOPER=1")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_funding_reorg_remote_lags(node_factory, bitcoind):
"""Nodes may disagree about short_channel_id before channel announcement
"""
@ -1335,6 +1342,8 @@ def test_bitcoind_goes_backwards(node_factory, bitcoind):
@flaky
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_reserve_enforcement(node_factory, executor):
"""Channeld should disallow you spending into your reserve"""
l1, l2 = node_factory.line_graph(2, opts={'may_reconnect': True, 'allow_warning': True})
@ -1870,6 +1879,8 @@ def test_dev_demux(node_factory):
l1.rpc.call('dev', {'subcommand': 'crash'})
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_list_features_only(node_factory):
features = subprocess.check_output(['lightningd/lightningd',
'--list-features-only']).decode('utf-8').splitlines()

View File

@ -22,6 +22,8 @@ import unittest
@pytest.mark.developer("needs to deactivate shadow routing")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_pay(node_factory):
l1, l2 = node_factory.line_graph(2)
@ -339,6 +341,8 @@ def test_pay_optional_args(node_factory, compat):
@pytest.mark.developer("needs to deactivate shadow routing")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_payment_success_persistence(node_factory, bitcoind, executor):
# Start two nodes and open a channel.. die during payment.
# Feerates identical so we don't get gratuitous commit to update them
@ -390,6 +394,8 @@ def test_payment_success_persistence(node_factory, bitcoind, executor):
@pytest.mark.developer("needs DEVELOPER=1")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_payment_failed_persistence(node_factory, executor):
# Start two nodes and open a channel.. die during payment.
# Feerates identical so we don't get gratuitous commit to update them
@ -2635,6 +2641,8 @@ def test_sendonion_rpc(node_factory):
@pytest.mark.developer("needs dev-disconnect, dev-no-htlc-timeout")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_partial_payment(node_factory, bitcoind, executor):
# We want to test two payments at the same time, before we send commit
l1, l2, l3, l4 = node_factory.get_nodes(4, [{}] + [{'disconnect': ['=WIRE_UPDATE_ADD_HTLC-nocommit'], 'dev-no-htlc-timeout': None}] * 2 + [{'plugin': os.path.join(os.getcwd(), 'tests/plugins/print_htlc_onion.py')}])
@ -3522,6 +3530,8 @@ def test_mpp_waitblockheight_routehint_conflict(node_factory, bitcoind, executor
@pytest.mark.developer("channel setup very slow (~10 minutes) if not DEVELOPER")
@pytest.mark.slow_test
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_mpp_interference_2(node_factory, bitcoind, executor):
'''
We create a "public network" that looks like so.

View File

@ -575,6 +575,8 @@ def test_invoice_payment_hook_hold(node_factory):
l1.rpc.pay(inv1['bolt11'])
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_openchannel_hook(node_factory, bitcoind):
""" l2 uses the reject_odd_funding_amounts plugin to reject some openings.
"""
@ -631,6 +633,8 @@ def test_openchannel_hook(node_factory, bitcoind):
l1.rpc.fundchannel(l2.info['id'], 100001)
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_openchannel_hook_error_handling(node_factory, bitcoind):
""" l2 uses a plugin that should fatal() crash the node.
@ -653,6 +657,8 @@ def test_openchannel_hook_error_handling(node_factory, bitcoind):
assert l2.daemon.is_in_log("BROKEN.*Plugin rejected openchannel[2]? but also set close_to")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_openchannel_hook_chaining(node_factory, bitcoind):
""" l2 uses a set of plugin that all use the openchannel_hook.
@ -672,7 +678,7 @@ def test_openchannel_hook_chaining(node_factory, bitcoind):
hook_msg = "openchannel2? hook rejects and says '"
# 100005sat fundchannel should fail fatal() for l2
# because hook_accepter.py rejects on that amount 'for a reason'
with pytest.raises(RpcError, match=r'They sent error channel'):
with pytest.raises(RpcError, match=r'reject for a reason'):
l1.rpc.fundchannel(l2.info['id'], 100005)
assert l2.daemon.wait_for_log(hook_msg + "reject for a reason")
@ -683,11 +689,14 @@ def test_openchannel_hook_chaining(node_factory, bitcoind):
# 100000sat is good for hook_accepter, so it should fail 'on principle'
# at third hook openchannel_reject.py
with pytest.raises(RpcError, match=r'They sent error channel'):
with pytest.raises(RpcError, match=r'reject on principle'):
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
l1.rpc.fundchannel(l2.info['id'], 100000)
assert l2.daemon.wait_for_log(hook_msg + "reject on principle")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_channel_state_changed_bilateral(node_factory, bitcoind):
""" We open and close a channel and check notifications both sides.
@ -826,6 +835,8 @@ def test_channel_state_changed_bilateral(node_factory, bitcoind):
assert(event2['message'] == "Onchain init reply")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_channel_state_changed_unilateral(node_factory, bitcoind):
""" We open, disconnect, force-close a channel and check for notifications.
@ -926,6 +937,8 @@ def test_channel_state_changed_unilateral(node_factory, bitcoind):
assert(event1['message'] == "Onchain init reply")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_channel_state_change_history(node_factory, bitcoind):
""" We open and close a channel and check for state_canges entries.
@ -1448,6 +1461,8 @@ def test_libplugin_deprecated(node_factory):
@unittest.skipIf(
not DEVELOPER or DEPRECATED_APIS, "needs LIGHTNINGD_DEV_LOG_IO and new API"
)
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_plugin_feature_announce(node_factory):
"""Check that features registered by plugins show up in messages.
@ -1702,6 +1717,8 @@ def test_hook_crash(node_factory, executor, bitcoind):
f1.result(10)
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_feature_set(node_factory):
plugin = os.path.join(os.path.dirname(__file__), 'plugins/show_feature_set.py')
l1 = node_factory.get_node(options={"plugin": plugin})
@ -1828,6 +1845,8 @@ def test_plugin_fail(node_factory):
@pytest.mark.developer("without DEVELOPER=1, gossip v slow")
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_coin_movement_notices(node_factory, bitcoind, chainparams):
"""Verify that coin movements are triggered correctly.
"""
@ -1916,6 +1935,14 @@ def test_coin_movement_notices(node_factory, bitcoind, chainparams):
# Special case for dual-funded channel opens
if l2.config('experimental-dual-fund'):
# option_anchor_outputs
l2_l3_mvts = [
{'type': 'chain_mvt', 'credit': 1000000000, 'debit': 0, 'tag': 'deposit'},
{'type': 'channel_mvt', 'credit': 0, 'debit': 100000000, 'tag': 'routed'},
{'type': 'channel_mvt', 'credit': 50000501, 'debit': 0, 'tag': 'routed'},
{'type': 'chain_mvt', 'credit': 0, 'debit': 4215501, 'tag': 'chain_fees'},
{'type': 'chain_mvt', 'credit': 0, 'debit': 945785000, 'tag': 'withdrawal'},
]
l2_wallet_mvts = [
{'type': 'chain_mvt', 'credit': 2000000000, 'debit': 0, 'tag': 'deposit'},
{'type': 'chain_mvt', 'credit': 0, 'debit': 0, 'tag': 'spend_track'},