MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_replacement_payload

Function test_replacement_payload

tests/test_plugin.py:2426–2447  ·  view source on GitHub ↗

Test that htlc_accepted plugin hook can replace payload

(node_factory)

Source from the content-addressed store, hash-verified

2424
2425
2426def test_replacement_payload(node_factory):
2427 """Test that htlc_accepted plugin hook can replace payload"""
2428 plugin = os.path.join(os.path.dirname(__file__), 'plugins/replace_payload.py')
2429 l1, l2 = node_factory.line_graph(
2430 2,
2431 opts=[{}, {"plugin": plugin}],
2432 wait_for_announce=True
2433 )
2434
2435 # Replace with an invalid payload.
2436 l2.rpc.call('setpayload', ['0000'])
2437 inv = l2.rpc.invoice(123, 'test_replacement_payload', 'test_replacement_payload')['bolt11']
2438 with pytest.raises(RpcError, match=r"Unexpected error \(invalid_onion_payload\) from final node"):
2439 l1.rpc.xpay(inv)
2440
2441 # Replace with valid payload, but corrupt payment_secret
2442 l2.rpc.call('setpayload', ['corrupt_secret'])
2443
2444 with pytest.raises(RpcError, match=r"Destination said it doesn't know invoice: incorrect_or_unknown_payment_details"):
2445 l1.rpc.xpay(inv)
2446
2447 assert l2.daemon.wait_for_log("Attempt to pay.*with wrong payment_secret")
2448
2449
2450def test_watchtower(node_factory, bitcoind, directory, chainparams):

Callers

nothing calls this directly

Calls 6

joinMethod · 0.80
line_graphMethod · 0.80
wait_for_logMethod · 0.80
callMethod · 0.45
invoiceMethod · 0.45
xpayMethod · 0.45

Tested by

no test coverage detected