Function create_phantom_invoice_with_description_hash
pub fn create_phantom_invoice_with_description_hash<ES, NS, L>(
amt_msat: Option<u64>,
payment_hash: Option<PaymentHash>,
invoice_expiry_delta_secs: u32,
description_hash: Sha256,
phantom_route_hints: Vec<PhantomRouteHints>,
entropy_source: ES,
node_signer: NS,
logger: L,
network: Currency,
min_final_cltv_expiry_delta: Option<u16>,
duration_since_epoch: Duration,
) -> Result<Bolt11Invoice, SignOrCreationError>
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 the route hints generated from
phantom_route_hints
will be limited to a maximum of 3 hints to ensure that the invoice can be scanned in a QR code. These hints are selected in the order that the nodes inPhantomRouteHints
are specified, selecting one hint per node until the maximum is hit. Callers may provide as manyPhantomRouteHints::channels
as desired, but note that some nodes will be trimmed if more than 3 nodes are provided.
description_hash
is a SHA-256 hash of the description text
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.
duration_since_epoch
is the current time since epoch in seconds.
Note that the provided keys_manager
’s NodeSigner
implementation must support phantom
invoices in its sign_invoice
implementation (PhantomKeysManager
satisfies this
requirement).
This can be used in a no_std
environment, where std::time::SystemTime
is not
available and the current time is supplied by the caller.