keysmanager: support phantom payments with PhantomKeysManager
authorValentine Wallace <vwallace@protonmail.com>
Mon, 27 Dec 2021 20:11:03 +0000 (15:11 -0500)
committerValentine Wallace <vwallace@protonmail.com>
Mon, 14 Feb 2022 19:22:37 +0000 (14:22 -0500)
commit4706c75028abdb0819024c22dc0066de7e4106dd
tree47ee82428f99795bf0a42a406a783cea4c4fc409
parent329ecdf88ff76a050d411f8a1cc4bec787d8b877
keysmanager: support phantom payments with PhantomKeysManager

To support the feature of generating invoices that can be paid to any of
multiple nodes, a key manager need to be able to share an inbound_payment_key
and phantom secret key. This is because a phantom payment may be received by
any node participating in the invoice, so all nodes must be able to decrypt the
phantom payment (and therefore must share decryption key(s)) in the act of
pretending to be the phantom node. Thus we add a new `PhantomKeysManager` that
supports these features.

To be more specific, the inbound payment key must be shared because it is used
to decrypt the payment details for verification (LDK avoids storing inbound
payment data by encrypting payment metadata in the payment hash and/or payment
secret).

The phantom secret must be shared because enables any real node included in the
phantom invoice to decrypt the final layer of the onion packet, since the onion
is encrypted by the sender using the phantom public key provided in the
invoice.
lightning/src/chain/keysinterface.rs