(
rpc, invoice, blockheight, my_node, entry_point, scid, in_amount, final_amount
)
| 7446 | plugin.incoming = channel |
| 7447 | |
| 7448 | def get_onion( |
| 7449 | rpc, invoice, blockheight, my_node, entry_point, scid, in_amount, final_amount |
| 7450 | ): |
| 7451 | assert len(invoice["invoice_paths"]) == 1 |
| 7452 | assert invoice["invoice_paths"][0]["first_node_id"] == entry_point |
| 7453 | path = invoice["invoice_paths"][0]["path"] |
| 7454 | path_key = invoice["invoice_paths"][0]["first_path_key"] |
| 7455 | assert len(path) == 2 |
| 7456 | |
| 7457 | final_tlvs = TlvPayload() |
| 7458 | final_tlvs.add_field(2, tu64_encode(final_amount)) |
| 7459 | final_tlvs.add_field(4, tu64_encode(blockheight + 18)) |
| 7460 | final_tlvs.add_field(10, bytes.fromhex(path[1]["encrypted_recipient_data"])) |
| 7461 | final_tlvs.add_field(18, tu64_encode(final_amount)) |
| 7462 | |
| 7463 | mid_tlvs = TlvPayload() |
| 7464 | mid_tlvs.add_field(10, bytes.fromhex(path[0]["encrypted_recipient_data"])) |
| 7465 | mid_tlvs.add_field(12, bytes.fromhex(path_key)) |
| 7466 | |
| 7467 | hops = [ |
| 7468 | { |
| 7469 | "pubkey": my_node, |
| 7470 | "payload": serialize_payload_tlv( |
| 7471 | in_amount, 18 + 6 + 6, scid, blockheight |
| 7472 | ).hex(), |
| 7473 | }, |
| 7474 | {"pubkey": entry_point, "payload": mid_tlvs.to_bytes().hex()}, |
| 7475 | { |
| 7476 | "pubkey": path[1]["blinded_node_id"], |
| 7477 | "payload": final_tlvs.to_bytes().hex(), |
| 7478 | }, |
| 7479 | ] |
| 7480 | |
| 7481 | return rpc.createonion(hops=hops, assocdata=invoice["invoice_payment_hash"])[ |
| 7482 | "onion" |
| 7483 | ] |
| 7484 | |
| 7485 | l1, l2 = node_factory.line_graph( |
| 7486 | 2, |
no test coverage detected