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 `ChannelManager::create_bolt11_invoice` #3389

Closed jkczyz closed 2 weeks ago

jkczyz commented 1 month ago

Now that the lightning crate depends on the lightning_invoice crate, the utility functions previously living in the latter can be implemented on ChannelManager. Additionally, the parameters are now moved to a struct in order to remove the increasingly combinatorial blow-up of methods.

The new Bolt11InvoiceParameters is used to determine what values to set in the invoice. Using None for any given parameter results in a reasonable the default or a behavior determined by the ChannelManager as detailed in the documentation.

Fixes #3375

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 64.18605% with 77 lines in your changes missing coverage. Please review.

Project coverage is 89.62%. Comparing base (2c1e828) to head (7878801). Report is 398 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/invoice_utils.rs 68.57% 44 Missing :warning:
lightning/src/ln/channelmanager.rs 58.33% 20 Missing and 5 partials :warning:
lightning-invoice/src/lib.rs 46.66% 8 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3389 +/- ## ========================================== + Coverage 89.57% 89.62% +0.04% ========================================== Files 125 128 +3 Lines 101756 104907 +3151 Branches 101756 104907 +3151 ========================================== + Hits 91151 94019 +2868 - Misses 7884 8175 +291 + Partials 2721 2713 -8 ```

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

valentinewallace commented 3 weeks ago

CI is still sad

jkczyz commented 3 weeks ago

Squashed fixups and fixed a no-std test compilation failure.