(node_factory, bitcoind)
| 7005 | |
| 7006 | |
| 7007 | def test_fetchinvoice_with_payer_metadata(node_factory, bitcoind): |
| 7008 | # We remove the conversion plugin on l3, causing it to get upset. |
| 7009 | l1, l2 = node_factory.line_graph(2, wait_for_announce=True) |
| 7010 | |
| 7011 | # Simple default offer first. |
| 7012 | offer = l2.rpc.call('offer', {'amount': 'any'}) |
| 7013 | assert offer['created'] is True |
| 7014 | |
| 7015 | # Fetch an invoice for a monthly payroll for two different people, one is macros and the other is vincenzopalazzo. |
| 7016 | # Now the payroll software has a bug and injects the wrong payer_node description (this often happens with wire descriptions). |
| 7017 | inv1 = l1.rpc.call('fetchinvoice', {'offer': offer['bolt12'], 'amount_msat': '1sat', 'payer_note': 'Payment For vincenzopalazzo', 'payer_metadata': b'macros'.hex()})['invoice'] |
| 7018 | inv2 = l1.rpc.call('fetchinvoice', {'offer': offer['bolt12'], 'amount_msat': '1sat', 'payer_note': 'Payment For vincenzopalazzo', 'payer_metadata': b'vincenzopalazzo'.hex()})['invoice'] |
| 7019 | assert inv1 != inv2 |
| 7020 | # At this point, macros noticed the bug in the payroll system and reported a |
| 7021 | # 'not paid for the current month' issue. The payroll system can verify that |
| 7022 | # there is a bug in the fetchinvoice, but it can also prove that the payment was sent |
| 7023 | # to macros because the payroll system can generate the `payer_id` with the `macros` metadata. |
| 7024 | decode1 = l1.rpc.call('decode', {'string': inv1}) |
| 7025 | decode2 = l1.rpc.call('decode', {'string': inv2}) |
| 7026 | assert decode1['invreq_payer_id'] != decode2['invreq_payer_id'] |
| 7027 | |
| 7028 | # Delay to avoid sending too many onion messages per second! |
| 7029 | time.sleep(1) |
| 7030 | |
| 7031 | inv3 = l1.rpc.call('fetchinvoice', {'offer': offer['bolt12'], 'amount_msat': '1sat', 'payer_note': 'Payment For vincenzopalazzo', 'payer_metadata': b'macros'.hex()})['invoice'] |
| 7032 | decode3 = l1.rpc.call('decode', {'string': inv3}) |
| 7033 | assert decode1['invreq_payer_id'] == decode3['invreq_payer_id'] |
| 7034 | |
| 7035 | |
| 7036 | def test_pay_unannounced_routehint(node_factory, bitcoind): |
nothing calls this directly
no test coverage detected