pub fn create_phantom_invoice<Signer: Sign, K: Deref>(
    amt_msat: Option<u64>,
    payment_hash: Option<PaymentHash>,
    description: String,
    invoice_expiry_delta_secs: u32,
    phantom_route_hints: Vec<PhantomRouteHints>,
    keys_manager: K,
    network: Currency
) -> Result<Invoice, SignOrCreationError<()>> where
    K::Target: KeysInterface
Available on crate feature std only.
Expand description

Utility to create an invoice that can be paid to one of multiple nodes, or a “phantom invoice.” See PhantomKeysManager for more information on phantom node payments.

phantom_route_hints parameter:

  • Contains channel info for all nodes participating in the phantom invoice
  • Entries are retrieved from a call to ChannelManager::get_phantom_route_hints on each participating node
  • It is fine to cache phantom_route_hints and reuse it across invoices, as long as the data is updated when a channel becomes disabled or closes
  • Note that if too many channels are included in PhantomRouteHints::channels, the invoice may be too long for QR code scanning. To fix this, PhantomRouteHints::channels may be pared down

payment_hash can be specified if you have a specific need for a custom payment hash (see the difference between ChannelManager::create_inbound_payment and ChannelManager::create_inbound_payment_for_hash). If None is provided for payment_hash, then one will be created.

invoice_expiry_delta_secs describes the number of seconds that the invoice is valid for in excess of the current time.

Note that the provided keys_manager’s KeysInterface implementation must support phantom invoices in its sign_invoice implementation (PhantomKeysManager satisfies this requirement).