Commit graph

303 commits

Author SHA1 Message Date
Matt Corallo
23e9fc79fd Bump versions to LDK 116-alpha1 and invoice 24.0-alpha1 2023-06-23 19:43:26 +00:00
valentinewallace
9cafede23c
Merge pull request #2340 from TheBlueMatt/2023-06-fix-docs
Remove spurious docs which imply you cannot retry a failed payment
2023-06-06 16:41:22 +02:00
Matt Corallo
60ce627b23 Remove spurious double comma in documentation 2023-06-06 00:44:06 +00:00
Matt Corallo
632c0d22b5 Remove spurious docs which imply you cannot retry a failed payment
If a payment (fully) fails, users are free to retry it, its only
once a payment succeeds that a user must never retry it.
2023-06-05 23:53:45 +00:00
Jeffrey Czyz
486c16a26d
Merge pull request #2290 from upjohnc/2240_replace_vectors_with_iterators
Set return type to Iterator for functions in file: `lightning-invoice/src/utils.rs` : issue #2240
2023-06-05 13:43:46 -05:00
Chad Upjohn
ec67ee7020 Refactor lightning-invoice/src/utils.rs to yield iterators
- two functions refatored: `select_phantom_hints`, `sort_and_filter_channels`
2023-06-01 14:45:38 -05:00
Chad Upjohn
31807bc2f6 Adding rotate_through_iterators for select_phantom_hints refactor
- adding function to allow for select_phantom_hints to yield an iterator
2023-05-31 11:46:08 -05:00
benthecarman
3003f7d719
Derive a PartialEq and Eq for PaymentError
This lets users compare error types more easily without needing a match
statement.
2023-05-24 17:40:48 -05:00
Wilmer Paulino
7b64527b16
Merge pull request #2279 from benthecarman/ord-invoice
Impl PartialOrd and Ord for Invoice
2023-05-10 11:24:00 -07:00
benthecarman
2ddce64ba6
Impl PartialOrd and Ord for Invoice 2023-05-09 12:39:17 -05:00
Matt Corallo
0ecb4b093a
Merge pull request #2258 from valentinewallace/2023-04-blinded-pathfinding-groundwork-2
Prefactor `PaymentParameters` for blinded recipients
2023-05-08 23:17:42 +00:00
Valentine Wallace
6d62b62cec
Error if BOLT 11 features are provided for blinded payment params 2023-05-08 18:01:43 -04:00
Valentine Wallace
cea78f585a
Error if clear hints are provided for blinded PaymentParams 2023-05-04 10:50:53 -04:00
Martin Habovstiak
6964299fc5 Remove unneeded allocation
`<E as serde:🇩🇪:Error>::custom()` accepts any `T: Display`, not just
`String`. Therefore it accepts `Arguments<'_>` too so we can use
`format_args!()` instead of `format!()`.

See https://github.com/lightningdevkit/rust-lightning/pull/2187#discussion_r1168781355
2023-05-04 11:21:04 +02:00
Arik Sosman
6cb9919f0c
Move keysinterface.rs to a directory-level module called sign. 2023-05-02 21:48:08 -07:00
Matt Corallo
c3de782a2b
Merge pull request #2044 from freddiekrugerrand/1782-limitchannelhints
Limit route hints to three channels
2023-04-27 22:02:16 +00:00
Matt Corallo
53c48c1c8f Add a bindings constructor for lightning-invoice's Sha256 wrapper 2023-04-25 22:51:18 +00:00
Fred Walker
905cd8bc65
Limit phantom invoice hints to 3 2023-04-25 15:46:20 -04:00
Fred Walker
3e65e625be
Move phantom route hint selection into its own function 2023-04-25 15:46:03 -04:00
Matt Corallo
fb424009e3 Bump crate versions to 0.0.115/invoice 0.23 2023-04-24 22:40:17 +00:00
Matt Corallo
2e15df730f
Merge pull request #2127 from TheBlueMatt/2023-03-payment-metadata
Support sending `PaymentMetadata` in HTLCs
2023-04-19 17:17:49 +00:00
Matt Corallo
ef8e3770a9 Fix variable name typo 2023-04-19 14:55:48 +00:00
Matt Corallo
a41d75fb08 Add some tests of payment metadata being sent and received 2023-04-19 14:55:48 +00:00
Matt Corallo
ee9afd315d Add a payment_metadata field to RecipientOnionFields
This adds the new `payment_metadata` to `RecipientOnionFields`,
passing the metadata from BOLT11 invoices through the send pipeline
and finally copying them info the onion when sending HTLCs.

This completes send-side support for the new payment metadata
feature.
2023-04-19 02:57:19 +00:00
Matt Corallo
8ed6e64913 Support setting the new payment metadata field in invoices
This adds support for setting the new payment metadata field in
BOLT11 invoices, using a new type flag on the builder to enforce
transition correctness.

We allow users to set the payment metadata as either optional or
required, defaulting to optional so that invoice parsing does not
fail if the sender does not support payment metadata fields.
2023-04-19 02:57:19 +00:00
Matt Corallo
928c9b806e Support reading the new payment_metadata field in invoices
This adds support for reading the new `PaymentMetadata` BOLT11
invoice field, giving us access to the `Vec<u8>` storing arbitrary
bytes we have to send to the recipient.
2023-04-19 02:57:19 +00:00
Matt Corallo
b709bb3e35 Mark the invoice Network getter no-export
...as it is redundant with the `currency` getter if we're not using
the rust-bitcoin types natively.
2023-04-17 17:44:19 +00:00
benthecarman
778c752a0b
Fix compiling lightning-invoice for no-std + serde 2023-04-15 15:38:53 -05:00
benthecarman
841dd1ea3a
Convert Network to and from Currency 2023-04-08 21:24:17 -05:00
Jeffrey Czyz
1ceb41e08b
Merge pull request #2023 from futurepaul/fallback-to-address
add `Fallback` getter that returns `Address`
2023-04-07 14:39:32 -05:00
Wilmer Paulino
a5ecb85171
Merge pull request #2162 from jkczyz/2023-04-invoice-hash 2023-04-07 10:11:36 -07:00
Jeffrey Czyz
821c79da98
Expose a BOLT 11 Invoice's signable_hash
Otherwise, an Invoice must first be converted to a SignedRawInvoice to
obtain the hash.
2023-04-06 23:15:25 -05:00
Jeffrey Czyz
854d650b5b
Linkify lightning-invoice docs 2023-04-06 23:13:05 -05:00
Paul Miller
cf0a90b8c0
Fallback: add Address getter and use bitcoin types 2023-04-06 10:49:14 -05:00
Fred Walker
20ef12f333
Sort route hints by inbound capacity and limit to 3 hints 2023-04-06 11:04:50 +02:00
Fred Walker
5b8af341e8
Update route hint selection to prefer lowest channel above minimum
This commit updates the way that we choose our preferred channel per
counterparty when selecting route hints. Previously, we would choose
the largest usable channel above our requested minimum.

This change updates selection to prefer the smallest channel above the
minimum amount (if provided, plus a scaling factor of 10% to allow
some margin for error). This is the off chain version of not "grinding
our change" - we want to supply route hints for channels that have
enough inbound to facilitate the receive, but not overload our high
inbound channels with smaller payments (since we may need this large
chunk of inbound for larger payment later on).

If there is no minimum amount provided, we err on the side of caution
and just select our highest inbound channels so that payments of any
size have a chance of succeeding. Likewise, if we have no channels above
the minimum, we select the largest channel to maximize our changes of
receiving the payment in multiple parts.
2023-04-06 11:04:48 +02:00
Matt Corallo
dddb2e28c1 Replace PaymentSecret with RecipientOnionFields in the pub API
This moves the public payment sending API from passing an explicit
`PaymentSecret` to a new `RecipientOnionFields` struct (which
currently only contains the `PaymentSecret`). This gives us
substantial additional flexibility as we look at add both
`PaymentMetadata`, a new (well, year-or-two-old) BOLT11 invoice
extension to provide additional data sent to the recipient.

In the future, we should also add the ability to add custom TLV
entries in the `RecipientOnionFields` struct.
2023-04-05 16:28:14 +00:00
Matt Corallo
2d4bf974e5
Merge pull request #2083 from wpaulino/events-module
Move events.rs into its own top-level module
2023-03-28 16:37:55 +00:00
Matt Corallo
3c02e507d6
Merge pull request #2125 from benthecarman/invoice-expire-time
Add helper functions for invoice expiry
2023-03-27 22:54:05 +00:00
benthecarman
56878595d7
Add helper functions for invoice expiry 2023-03-27 14:41:43 -05:00
Matt Corallo
2223e92ac6
Merge pull request #2110 from munjesi/docs_fixes
Replacing (C-not exported) in the docs
2023-03-27 18:12:00 +00:00
benthecarman
18c3318b78
Add generic InvoiceDescription to invoice in InvoiceBuilder 2023-03-23 00:07:16 -05:00
Wilmer Paulino
ca9ca75f08
Move events.rs into its own top-level module
This is largely motivated by some follow-up work for anchors that will
introduce an event handler for `BumpTransaction` events, which we can
now include in this new top-level `events` module.
2023-03-22 11:49:33 -07:00
munjesi
b0bf50fa24 Replacing (C-not exported) in the docs 2023-03-22 14:30:36 +03:00
Matt Corallo
ea15f0f448
Merge pull request #2100 from douglaz/docs_fixes
Docs improvements
2023-03-21 18:44:23 +00:00
Allan Douglas R. de Oliveira
963d6c4a51 Docs improvements 2023-03-21 14:11:13 +00:00
Matt Corallo
48fa2fd172
Merge pull request #2024 from TheBlueMatt/2023-02-6conf-pub-hints
Include a route hint for public, not-yet-announced channels
2023-03-19 23:42:15 +00:00
Matt Corallo
cab6c976b6 Include a route hint for public, not-yet-announced channels
If we have a public channel which doesn't yet have six
confirmations the network can't possibly know about it as we cannot
have announced it yet. However, because we refuse to include
route-hints if we have any public channels, we will generate
invoices that no one can pay.

Thus, if we have any public, not-yet-announced channels, include
them as a route-hint.
2023-03-18 00:45:23 +00:00
Matt Corallo
ccac926671
Merge pull request #2049 from douglaz/run-clippy-fix
Run clippy fix
2023-03-06 21:28:38 +00:00
Allan Douglas R. de Oliveira
57017dfc0b Run clippy --fix and cleanup code 2023-03-06 19:26:48 +00:00