Expand description
§Direct HTLC API
This module exposes the outgoing contract of the LNv2 module as a plain
HTLC between two clients of the same federation, without any Lightning
gateway involvement. This enables atomic swaps with counterparties outside
the federation’s Lightning infrastructure, e.g. swaps with other chains or
currencies.
The funder locks ecash to the counterparty’s claim key via
LightningClientModule::create_htlc. The counterparty verifies the
funding via LightningClientModule::await_htlc_funded and resolves the
HTLC with the preimage via LightningClientModule::claim_htlc, which
reveals the preimage to the funder via
LightningClientModule::await_htlc_resolution. A failed HTLC is either
cancelled cooperatively before its expiration with the counterparty’s
forfeit signature via LightningClientModule::cancel_htlc, or refunded
unilaterally after its expiration via
LightningClientModule::refund_htlc.
All coordination data - the contract, its funding outpoint and the forfeit
signature - is exchanged between the two parties out of band; the CLI and
the JSON representation of this data are documented in
docs/lightning_module_v2.md. The contract expiration is measured in
block count as tracked by the federation’s consensus, not in unix time.
Structs§
- Create
Htlc Operation Meta - Metadata of an operation funding a direct HTLC via
LightningClientModule::create_htlc. - Htlc
Spend 🔒 - The parameters of a transaction spending a direct HTLC; see
LightningClientModule::spend_htlc. The witness is the action taken on the contract, from which the operation id and the operation meta of the spend are derived. - Spend
Htlc Operation Meta - Metadata of an operation spending a direct HTLC: a claim via
LightningClientModule::claim_htlc, a refund viaLightningClientModule::refund_htlcor a cancellation viaLightningClientModule::cancel_htlc.
Enums§
- Htlc
Error - Errors of the direct HTLC operations; see
LightningClientModule::create_htlc.
Functions§
- is_
transient 🔒 - Whether a federation error is caused by connection failures only, such that retrying the request may succeed.