lightningdevkit / rust-lightning

A highly modular Bitcoin Lightning library written in Rust. It's rust-lightning, not Rusty's Lightning!
Other
1.17k stars 368 forks source link

Add general-purpose HTLC interception interface #2855

Open tnull opened 10 months ago

tnull commented 10 months ago

While we currently allow to intercept HTLCs based on magic-value SCIDs, LDK is currently lacking the capability to intercept HTLCs and give users control over claiming/forwarding/failing them.

As this feature has been regularly requested, we should add (optional) support for this, which would also give users the freedom to implement more advanced HTLC forwarding algorithms on top.

Related issues that might be closed/superseded by this:

2320

2425

2839

tnull commented 10 months ago

Tagging myself as I might be interested in working on this, even if not immediately.

MaxFangX commented 2 weeks ago

FYI we've worked around this somewhat by simply always including the magic-value SCID for user-generated invoices.

More important for us is an interface where we can just claim funds using a preimage received out-of-band (as elaborated on in #2839), in order to implement something akin to Phoenix's fee credits.

tnull commented 2 weeks ago

More important for us is an interface where we can just claim funds using a preimage received out-of-band (as elaborated on in https://github.com/lightningdevkit/rust-lightning/issues/2839), in order to implement something akin to Phoenix's fee credits.

Do you mind opening a separate issue for this, describing your particular requirements for such an interface?

FWIW, we might need parts of it for integration of Liquidity Ads-based just-in-time channels (i.e., the parts that would allow forwarding the to-be-forwarded onions ahead of time to allow client-side validation before sending a 'would claim' message, all before a channel is opened). So might be good to learn what your needs are to make sure we create an API that's reusable for both usecases.