mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
onion_message: dev options to ignore obsolete/modern onions.
This lets us test that both work, as expected. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
368fc07d05
commit
09c2fef4a4
@@ -4117,15 +4117,34 @@ def test_offer(node_factory, bitcoind):
|
||||
assert 'recurrence: every 600 seconds paywindow -10 to +600 (pay proportional)\n' in output
|
||||
|
||||
|
||||
@pytest.mark.developer("dev-no-modern-onion is DEVELOPER-only")
|
||||
def test_fetchinvoice_3hop(node_factory, bitcoind):
|
||||
l1, l2, l3, l4 = node_factory.line_graph(4, wait_for_announce=True,
|
||||
opts={'experimental-offers': None})
|
||||
opts={'experimental-offers': None,
|
||||
'may_reconnect': True})
|
||||
offer1 = l4.rpc.call('offer', {'amount': '2msat',
|
||||
'description': 'simple test'})
|
||||
assert offer1['created'] is True
|
||||
|
||||
l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12']})
|
||||
|
||||
# Test with obsolete onion.
|
||||
l4.stop()
|
||||
l4.daemon.opts['dev-no-modern-onion'] = None
|
||||
l4.start()
|
||||
l4.rpc.connect(l3.info['id'], 'localhost', l3.port)
|
||||
|
||||
l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12']})
|
||||
|
||||
# Test with modern onion.
|
||||
l4.stop()
|
||||
del l4.daemon.opts['dev-no-modern-onion']
|
||||
l4.daemon.opts['dev-no-obsolete-onion'] = None
|
||||
l4.start()
|
||||
l4.rpc.connect(l3.info['id'], 'localhost', l3.port)
|
||||
|
||||
l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12']})
|
||||
|
||||
|
||||
def test_fetchinvoice(node_factory, bitcoind):
|
||||
# We remove the conversion plugin on l3, causing it to get upset.
|
||||
@@ -4426,9 +4445,13 @@ def test_dev_rawrequest(node_factory):
|
||||
assert 'invoice' in ret
|
||||
|
||||
|
||||
def test_sendinvoice(node_factory, bitcoind):
|
||||
def do_test_sendinvoice(node_factory, bitcoind, disable):
|
||||
l2opts = {'experimental-offers': None}
|
||||
if disable:
|
||||
l2opts[disable] = None
|
||||
l1, l2 = node_factory.line_graph(2, wait_for_announce=True,
|
||||
opts={'experimental-offers': None})
|
||||
opts=[{'experimental-offers': None},
|
||||
l2opts])
|
||||
|
||||
# Simple offer to send money (balances channel a little)
|
||||
offer = l1.rpc.call('offerout', {'amount': '100000sat',
|
||||
@@ -4507,6 +4530,20 @@ def test_sendinvoice(node_factory, bitcoind):
|
||||
assert out['amount_received_msat'] == Millisatoshi(10000000)
|
||||
|
||||
|
||||
def test_sendinvoice(node_factory, bitcoind):
|
||||
do_test_sendinvoice(node_factory, bitcoind, None)
|
||||
|
||||
|
||||
@pytest.mark.developer("needs to --dev-no-obsolete-onion")
|
||||
def test_sendinvoice_modern(node_factory, bitcoind):
|
||||
do_test_sendinvoice(node_factory, bitcoind, 'dev-no-obsolete-onion')
|
||||
|
||||
|
||||
@pytest.mark.developer("needs to --dev-no-modern-onion")
|
||||
def test_sendinvoice_obsolete(node_factory, bitcoind):
|
||||
do_test_sendinvoice(node_factory, bitcoind, 'dev-no-modern-onion')
|
||||
|
||||
|
||||
def test_self_pay(node_factory):
|
||||
"""Repro test for issue 4345: pay ourselves via the pay plugin.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user