rust-lightning icon indicating copy to clipboard operation
rust-lightning copied to clipboard

Support paying directly to Human Readable Names using bLIP 32

Open TheBlueMatt opened this issue 1 year ago • 2 comments

Based on #3179 this fully implements BIP 353 sends using bLIP 32 DNS resolution with a wonderfully simple API:

        pub fn pay_for_offer_from_human_readable_name(
                &self, name: HumanReadableName, amount_msats: u64, payment_id: PaymentId,
                retry_strategy: Retry, max_total_routing_fee_msat: Option<u64>,
                dns_resolvers: Vec<Destination>,
        ) -> Result<(), ()> {

Still needs a few trivial things piped out through to events (eg DNSSEC proofs as "proof of payment"), but its basically done!

TheBlueMatt avatar Aug 30 '24 21:08 TheBlueMatt

Codecov Report

Attention: Patch coverage is 85.27132% with 76 lines in your changes missing coverage. Please review.

Project coverage is 89.67%. Comparing base (b0bd437) to head (cbdb8cb). Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
lightning-dns-resolver/src/lib.rs 86.77% 34 Missing and 5 partials :warning:
lightning/src/ln/channelmanager.rs 79.27% 16 Missing and 7 partials :warning:
lightning/src/ln/outbound_payment.rs 83.60% 9 Missing and 1 partial :warning:
lightning/src/onion_message/dns_resolution.rs 40.00% 1 Missing and 2 partials :warning:
lightning/src/offers/refund.rs 85.71% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3283      +/-   ##
==========================================
+ Coverage   89.65%   89.67%   +0.02%     
==========================================
  Files         128      129       +1     
  Lines      104821   105419     +598     
  Branches   104821   105419     +598     
==========================================
+ Hits        93980    94538     +558     
- Misses       8130     8138       +8     
- Partials     2711     2743      +32     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 30 '24 21:08 codecov[bot]

Should be ready for review now that the dependent PR landed @arik-so @tnull

TheBlueMatt avatar Oct 02 '24 17:10 TheBlueMatt

Added a commit to set the feature bit added in #3346.

TheBlueMatt avatar Oct 08 '24 19:10 TheBlueMatt

Rebased and addressed CI issues.

TheBlueMatt avatar Oct 28 '24 19:10 TheBlueMatt

I'm good with squashing the fixups at this point.

arik-so avatar Oct 29 '24 17:10 arik-so

Squashed the fixups without further changes.

TheBlueMatt avatar Oct 29 '24 18:10 TheBlueMatt

Addressed feedback and rebased.

TheBlueMatt avatar Nov 07 '24 15:11 TheBlueMatt

Squashed without further changes.

TheBlueMatt avatar Nov 08 '24 14:11 TheBlueMatt

Squashed without changes then had to rebase to address a conflict:

$ git range-diff 8c086c772f2f4def5aecc549b2d39f2ab427081d..ce3b143c314ffb640dbdb569dd6c8882e008a0f3 b0bd4371d989722aa38ddfc2f35db8922e3304bb..cbdb8cb0cb5f1e8b9e676ad2d130b8bbc2b9e640
1:  3fdc51c8b = 1:  a39e274e3 Skip the implicit trailing `.` in `HumanReadableName`'s domain
2:  126f7f455 = 2:  46df35b0f Add a new `AwaitingOffer` outbound payment state for BIP 353
3:  84887e686 = 3:  e447b4913 Add support for storing a source HRN in BOLT 12 `invoice_request`s
4:  6aa1bb2bc = 4:  8d8416b95 Store the source `HumanReadableName` in `InvoiceRequestFields`
5:  10eb7cf8a ! 5:  99d00930a Support paying Human Readable Names directly from `ChannelManager`
    @@ lightning/src/ln/channelmanager.rs: where
        /// to pay us.
        ///
     @@ lightning/src/ln/channelmanager.rs: where
    -           payment_secrets.retain(|_, inbound_payment| {
    -                   inbound_payment.expiry_time > header.time as u64
    -           });
    +                   }
    +           }
    +           max_time!(self.highest_seen_timestamp);
     +          #[cfg(feature = "dnssec")] {
     +                  let timestamp = self.highest_seen_timestamp.load(Ordering::Relaxed) as u32;
     +                  self.hrn_resolver.new_best_block(height, timestamp);
6:  ef273123b = 6:  2bbb3b708 Use `ChannelManager` as `DNSResolverMessageHandler` by default
7:  af3c4accf = 7:  8e941426c Add a `lightning-dns-resolver` crate which answers bLIP 32 queries
8:  ce3b143c3 = 8:  cbdb8cb0c Set the `dns_resolution` feature in `OMDomainResolver`

TheBlueMatt avatar Nov 12 '24 15:11 TheBlueMatt