Commit graph

168 commits

Author SHA1 Message Date
Matt Corallo
ea5b62fff6
Merge pull request #1677 from ok300/ok300-patch-1
Bump bitcoin_hashes to v0.11
2022-08-19 22:18:59 +00:00
NicolaLS
e263d904a1 derive Hash for Invoice 2022-08-19 16:40:54 +02:00
ok300
1cc2bc5145
Bump bitcoin_hashes to v0.11 2022-08-19 16:40:19 +02:00
Matt Corallo
b414c0641b
Merge pull request #1658 from lightning-signer/2022-08-bitcoin-0-29
Update bitcoin crate to 0.29.0
2022-08-12 23:51:06 +00:00
Devrandom
7e05623bef Update bitcoin crate to 0.29.0 2022-08-11 00:21:26 +02:00
Valentine Wallace
c242003dd3
Fix CI to error on doc links to private items
Somehow we weren't doing this.
2022-08-07 13:49:12 -04:00
Matt Corallo
6b1ec5c738
Merge pull request #1632 from TheBlueMatt/2022-07-warnings
Fix compilation warnings
2022-07-27 16:29:09 +00:00
Matt Corallo
e10dfe4fd0 Bump crate versions to 0.0.110/invoice 0.18 2022-07-26 22:01:09 +00:00
Matt Corallo
4da6f23cff Drop unused test code in lightning-invoice::payment 2022-07-26 20:31:17 +00:00
Elias Rohrer
eb8bce0d16 Add send_probe and introduce probing cookies
When we send payment probes, we generate the [`PaymentHash`] based on a
probing cookie secret and a random [`PaymentId`]. This allows us to
discern probes from real payments, without keeping additional state.
2022-07-07 09:02:29 +02:00
Matt Corallo
156cc77753 Bump crate versions to 0.0.109/invoice 0.17 2022-07-01 16:05:33 +00:00
Matt Corallo
87a6e013f7 Have find_route take a NetworkGraph instead of a ReadOnly one
Because downstream languages are often garbage-collected, having
the user directly allocate a `ReadOnlyNetworkGraph` and pass a
reference to it to `find_route` often results in holding a read
lock long in excess of the `find_route` call. Worse, some languages
(like JavaScript) tend to only garbage collect when other code is
not running, possibly leading to deadlocks.
2022-06-29 17:45:49 +00:00
NicolaLS
6c15de1399 add optional dependency on serde to implement serialize/deserialize for invoice 2022-06-20 11:49:30 +02:00
Wilmer Paulino
44fa3acae8
Rename UserConfig and LegacyChannelConfig fields
The current names aren't very clear to what each field represents, this
commit aims to improve that.
2022-06-13 13:57:00 -07:00
Matt Corallo
5421e1a6e7
Merge pull request #1529 from wpaulino/move-channel-config-static-fields
Move ChannelConfig static fields to ChannelHandshakeConfig
2022-06-13 04:04:23 -07:00
Matt Corallo
deac430f17 Update crate versions to 0.0.108/invoice 0.16 2022-06-10 14:53:23 +00:00
Wilmer Paulino
850ca13fbc
Move announced_channel to ChannelHandshakeConfig
In the near future, we plan to allow users to update their
`ChannelConfig` after the initial channel handshake. In order to reuse
the same struct and expose it to users, we opt to move out all static
fields that cannot be updated after the initial channel handshake.
2022-06-09 16:11:15 -07:00
Jeffrey Czyz
b2e635f619
Bump crate versions to 0.0.107/invoice 0.15 2022-06-08 18:16:48 -05:00
Jeffrey Czyz
67736b7480
Parameterize NetworkGraph with Logger
P2PGossipSync logs before delegating to NetworkGraph in its
EventHandler. In order to share this handling with RapidGossipSync,
NetworkGraph needs to take a logger so that it can implement
EventHandler instead.
2022-06-06 13:02:43 -05:00
Jeffrey Czyz
574870e9f8
Move network_graph.rs to gossip.rs
The routing::network_graph module contains a few structs related to p2p
gossip. So renaming the module to 'gossip' seems more appropriate.
2022-06-02 15:15:30 -07:00
Justin Moon
7b8f6843f5 Add 'repository' to lightning-invoice's Cargo.toml 2022-06-01 13:17:16 -05:00
Elias Rohrer
e98f68aee6 Rename FundingLocked to ChannelReady. 2022-05-30 17:07:09 -07:00
Jeffrey Czyz
75ca50f5c0
Merge pull request #1490 from arik-so/rust_beta_doc_fix
Fix rust beta docs for lightning-invoice crate.
2022-05-23 00:16:04 -05:00
Arik Sosman
46e58ae025
Merge pull request #1492 from tnull/2022-05-fix-bolts-url
Docs: Update to 'new' spec repository URL.
2022-05-20 11:20:55 -07:00
Arik Sosman
71d89d2c98
Fix rust beta docs lightning-invoice crate. 2022-05-20 08:31:56 -07:00
Elias Rohrer
ba7935d1f3 Use new spec repository URL. 2022-05-20 17:17:29 +02:00
Jeffrey Czyz
197cbc4d28
Pass effective capacity to scorer
Scorers could benefit from having the channel's EffectiveCapacity rather
than a u64 msat value. For instance, ProbabilisticScorer can give a more
accurate penalty when given the ExactLiquidity variant. Pass a struct
wrapping the effective capacity, the proposed amount, and any in-flight
HTLC value.
2022-05-19 14:25:22 -05:00
KaFai Choi
b7d6d0dc8e
add timeout retry strategy to outbound payment 2022-05-17 13:27:22 +07:00
Duncan Dean
ea016cd824
Address post-ACK formatting nits from #1474 2022-05-11 10:57:38 +02:00
Duncan Dean
3369b2962d
Add expiry to non-phantom invoice utils 2022-05-10 20:22:01 +02:00
Duncan Dean
15a840147a
Actually add expiry to phantom invoice utils 2022-05-10 20:18:06 +02:00
Devrandom
28d33ff9e0 bitcoin crate 0.28.1 2022-05-05 18:04:42 +02:00
Viktor Tigerström
3c67687066 Add htlc min/max to create invoice functions 2022-04-21 12:27:51 +02:00
Duncan Dean
8f047ca23f
Add expiry to inbound payment util functions 2022-04-16 22:49:28 +02:00
Matt Corallo
03f655003d
Merge pull request #1384 from valentinewallace/2022-03-chanmanless-phantom-invoices 2022-04-13 14:51:35 +00:00
Valentine Wallace
204dd42a7d
Expose methods for ChannelManager-less phantom invoice generation 2022-04-11 18:43:48 -04:00
Matt Corallo
ce5a9f528a Move lightning-invoice deser errors to lib.rs instead of pub use
Having public types in a private module is somewhat awkward from a
readability standpoint, but, more importantly, the bindings logic
has a relatively rough go of converting them - it doesn't implement
`pub use` as its "implement this function" logic is all within the
context of a module. We'd need to keep a set of re-exported things
to implement them when parsing modules...or we could just move two
enums from `de.rs` to `lib.rs` here, which is substantially less
work.
2022-04-04 13:19:41 +00:00
Jeffrey Czyz
de8bb8d261
Bump crate versions to 0.0.106/invoice 0.14 2022-04-03 08:05:08 -05:00
Luiz Parreira
7714393cf0
Create normal/phantom invoice with description hash 2022-03-18 15:08:00 -03:00
Viktor Tigerström
ff792e05bb Add phantom invoice route hints filtering tests 2022-03-16 11:24:12 +01:00
Viktor Tigerström
43cc81c893 Filter route hints for phantom invoices
Filter the route hints in `create_phantom_invoice` based on the
following criteria:

* Only one channel for every counterparty node per phantom
payment-receiving node in the invoice
* Always select the channel with the highest inbound capacity
* For each payment-receiving node, filter out channels with a lower
inbound capacity than the invoice amount, if any channel exists with
enough capacity to cover the invoice amount
* If any public channels exists for a payment-receiving node, push a
single RouteHintHop with the phantom route and let the sender find the
path to the payment-receiving node through the public channels.
2022-03-16 11:24:12 +01:00
Viktor Tigerström
eae5086b8d Add tests for create invoice route hints filtering 2022-03-16 11:24:12 +01:00
Viktor Tigerström
fe49fbd7b8 Filter route hints for create invoice
Filter the route hints in `create_invoice_from_channelmanager` based on
the following criteria:

* Only one channel per counterparty node
* Always select the channel with the highest inbound capacity
* Filter out channels with a lower inbound capacity than the invoice
amount, if any channel exists with enough capacity to cover the invoice
amount
* If any public channel exists, the invoice route_hints should be empty,
and the sender will need to find the path to the payment-receiving node
by looking at the public channels instead
2022-03-16 11:24:12 +01:00
Jeffrey Czyz
ca163c3fae
Merge pull request #1331 from TheBlueMatt/2022-02-no-copy-invoice-fields
Use &mut self in invoice updaters, not take-self-return-Self
2022-03-11 14:26:02 -06:00
Matt Corallo
b1cd5a7434
Merge pull request #1311 from TheBlueMatt/2022-02-0conf-part-1
Support for SCID Aliases
2022-03-10 00:47:23 +00:00
Matt Corallo
b2629afd88 Track SCID aliases from our counterparty and use them in invoices
New `funding_locked` messages can include SCID aliases which our
counterparty will recognize as "ours" for the purposes of relaying
transactions to us. This avoids telling the world about our
on-chain transactions every time we want to receive a payment, and
will allow for receiving payments before the funding transaction
appears on-chain.

Here we store the new SCID aliases and use them in invoices instead
of he "standard" SCIDs.
2022-03-09 19:14:38 +00:00
Elias Rohrer
e92b5a7ebd Add a random per-path CLTV offset for privacy. 2022-03-09 11:13:47 -06:00
Jeffrey Czyz
d70292d6c8
Fix compilation warnings with --features=no-std 2022-03-08 23:23:25 -06:00
Matt Corallo
def0628332 Bump crate versions to 0.0.105/invoice 0.13 2022-03-01 00:43:24 +00:00
Matt Corallo
b7d57ea83e Use &mut self in invoice updaters, not take-self-return-Self
The take-self-return-Self idiom in Rust is substantially less
usable than it is in Java, where its more common. Because we have
to take self by move, it prevents using the update methods to
actually update features, something we occasionally want to do.

See, eg, the change in lightning-invoice where we previously had
to copy and re-create an entire vec of fields just to update the
features field, which is nuts.

There are a few places where this makes things a little less clean,
but the tradeoff to enable more effecient and broader uses of the
update methods seems worth it.
2022-02-23 20:17:36 +00:00