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

Function test_createproof_note

tests/test_pay.py:7342–7364  ·  view source on GitHub ↗

Proof with a note: decoded proof should include it.

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

7340
7341
7342def test_createproof_note(node_factory, bitcoind):
7343 """Proof with a note: decoded proof should include it."""
7344 l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True,
7345 opts=[{},
7346 {'dev-allow-localhost': None},
7347 {'dev-allow-localhost': None}])
7348
7349 offer = l3.rpc.offer('5000msat', 'note test')
7350 inv = l1.rpc.fetchinvoice(offer['bolt12'])['invoice']
7351 l1.rpc.xpay(inv)
7352
7353 ret = l1.rpc.call('createproof', {'invstring': inv, 'note': 'I paid for this!'})
7354 proof = only_one(ret['proofs'])
7355
7356 decoded = l1.rpc.decode(proof['bolt12'])
7357 assert decoded['valid'] is True
7358 assert decoded['proof_note'] == 'I paid for this!'
7359
7360 # Proof without note decodes fine with absent payer_note.
7361 ret2 = l1.rpc.call('createproof', {'invstring': inv})
7362 decoded2 = l1.rpc.decode(only_one(ret2['proofs'])['bolt12'])
7363 assert decoded2['valid'] is True
7364 assert 'proof_note' not in decoded2
7365
7366
7367def test_createproof_include(node_factory, bitcoind):

Callers

nothing calls this directly

Calls 7

only_oneFunction · 0.90
line_graphMethod · 0.80
fetchinvoiceMethod · 0.80
offerMethod · 0.45
xpayMethod · 0.45
callMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected