server_htlc_receive_taproot

Function server_htlc_receive_taproot 

Source
pub fn server_htlc_receive_taproot(
    payment_hash: PaymentHash,
    server_pubkey: PublicKey,
    user_pubkey: PublicKey,
    exit_delta: u16,
    htlc_expiry: u32,
) -> TaprootSpendInfo
Expand description

Build taproot spend info to build a VTXO for Alice lightning receive

This related to the [VtxoPolicy::ServerHtlcRecv] policy.

This build a taproot with 3 clauses:

  1. The keyspend path allows Alice and Server to collaborate to spend the HTLC. This is the expected path to be used. Server should only accept to collaborate if Alice reveals the preimage.

  2. One leaf of the tree allows Server to spend the HTLC after the expiry, with an exit delta delay. Server can use this path if Alice tries to spend the HTLC using the 3rd path after the HTLC expiry

  3. The other leaf of the tree allows Alice to spend the HTLC if she knows the preimage, but with a greater exit delta delay than Server. Alice must use this path if she revealed the preimage but Server refused to collaborate using the 1rst path.