Commit graph

5222 commits

Author SHA1 Message Date
Matt Corallo
2775902f3a Add an additional test/bench for routing larger amounts, score more
When benchmarking our router, we previously only ever tested with
amounts under 1,000 sats, which is an incredibly small amount.
While this ensures we have the maximal number of available channels
to consider, it prevents our scorer from getting exercise across
its range. Further, we only score the immediate path we are
expecting to to send over, and not randomly but rather based on the
amount sent.

Here we try to make the benchmarks a bit more realistic by adding
a new benchmark which attempts to send around 100K sats, which is
a reasonable amount to send over a channel today. We also convert
the scoring data to be randomized based on the seed as well as
attempt to (possibly) find a new route for a much larger value and
score based on that. This potentially allows us to score multiple
potential paths between the source and destination as the large
route-find may return an MPP result.
2023-05-11 05:49:17 +00:00
Matt Corallo
fbaa3c4855 Unify route benchmarking with route tests
There's a few route tests which do the same thing as the benchmarks
as they're also a good test. However, they didn't share code, which
is somewhat wasteful, so we fix that here.
2023-05-11 05:42:21 +00:00
Matt Corallo
e61b128967
Merge pull request #2237 from henghonglee/issue-2189-score-params
[#2189] Score Fee Params as a passed in parameter
2023-05-11 05:27:14 +00:00
henghonglee
86af670afa Move functions around to colocate impl of FeeParams and DecayParams 2023-05-10 15:32:29 -07:00
henghonglee
21b0818be7 Score's FeeParams as passed-in params on Routefinding functions
This PR aims to create a "stateless" scorer. Instead of passing
in fee params at construction-time, we want to parametrize the
scorer with an associated "parameter" type, which is then
passed to the router function itself, and allows passing
different parameters per route-finding call.
2023-05-10 12:53:42 -07: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
Matt Corallo
9e542ec8c7
Merge pull request #2287 from TheBlueMatt/2023-05-no-background-event-dup-persist
Stop persisting background shutdown monitor updates
2023-05-10 00:02:31 +00:00
Matt Corallo
5c090a2ed4 Rename ClosingMonitorUpdate MonitorUpdateRegeneratedOnStartup
This makes much clearer at sites generating such events that they
will be lost on restart, to reduce risk of bugs creeping in due to
lost monitor updates.
2023-05-09 21:24:56 +00:00
Matt Corallo
135f4149ed Stop persisting background shutdown monitor updates
In d4810087c1 we added logic to apply `ChannelMonitorUpdate`s which
were a part of a channel closure async via a background queue to
address some startup issues. When we did that we persisted those
updates to ensure we replayed them when starting next time.

However, there was no reason to - if we persisted and then
restarted even without those monitor updates we'd find a monitor
without a channel, which we'd tell to broadcast the latest
commitment transaction to force-close.

Since adding that logic, we've used the same background queue for
several purposes.
2023-05-09 21:03:07 +00:00
benthecarman
2ddce64ba6
Impl PartialOrd and Ord for Invoice 2023-05-09 12:39:17 -05:00
Matt Corallo
f569e9f802
Merge pull request #2281 from dunxen/2023-05-dfmsgfollowups
Dual funding message follow-ups
2023-05-09 17:10:38 +00:00
Matt Corallo
7884bc43a3
Merge pull request #2270 from tnull/2023-05-improve-tx-sync-compat-notice
Make `lightning-transaction-sync` compat notice a bit more explicit
2023-05-09 17:06:43 +00:00
Wilmer Paulino
1279c6807c
Merge pull request #2278 from benthecarman/faster-u16-check
Check too many tx outputs upfront when verifying funding tx
2023-05-09 09:53:12 -07:00
valentinewallace
71af4a2d15
Merge pull request #2277 from valentinewallace/2023-05-fix-big-oms
Fix large onion message packet generation
2023-05-09 08:50:28 -04:00
Elias Rohrer
ff865eb685
Make lightning-transaction-sync compat notice a bit more explicit
As `lightning-transaction-sync` was introduced with 0.0.114 and depended
on prior changes in the same release cycle we deemed it reasonable to
omit the implicitly limited backwards compatibility.

It however turns out this might be confusing to users copy/pasting the
codebase. Here we therefore spell out the implicit dependency on 0.0.114
and above.
2023-05-09 10:44:48 +02:00
Duncan Dean
33e901a88f
Enforce that no bytes remain for TransactionU16LenLimited read 2023-05-09 08:37:58 +02:00
Duncan Dean
f389a0ec39
Move TransactionU16LenLimited to ser.rs 2023-05-09 08:19:32 +02: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
benthecarman
fcd1127c01
Check too many tx outputs upfront when verifying funding tx 2023-05-08 17:49:05 -05:00
Valentine Wallace
d56672c11d
Move final_cltv_expiry_delta from PaymentParams to Payee::Clear
Since blinded pay params won't have this value.
2023-05-08 18:01:43 -04:00
Valentine Wallace
746f25aed0
Add BOLT 12 features to PaymentParams 2023-05-08 18:01:43 -04:00
Valentine Wallace
91dc76721b
Move BOLT11 features from top level PaymentParams to Payee::Clear
Since blinded payees don't have this.
2023-05-08 18:01:43 -04: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
7f49f6bf4d
Move payee node id from top level PaymentParams to Payee::Clear
Since blinded payees don't have one
2023-05-08 18:01:41 -04:00
Valentine Wallace
f18661f6f6
Fix onion messages of size BIG_PACKET_HOP_DATA_LEN
This was previously broken and would result in an invalid HMAC error, because
we had a hardcoded assumption that OM hop data would always be of size 1300.
2023-05-08 15:02:42 -04:00
Valentine Wallace
408b12f034
Fix broken test utils in OnionMessenger and stop asserting on logs 2023-05-08 14:22:43 -04:00
Wilmer Paulino
40626958e4
Merge pull request #1794 from dunxen/2022-10-dualfunding-act-1
Dual funding and interactive tx construction wire messages
2023-05-08 10:47:51 -07:00
Matt Corallo
0a0c54cc31
Merge pull request #2269 from TheBlueMatt/2023-05-doc-events-present
Document when event fields are `Some`
2023-05-08 16:39:15 +00:00
Matt Corallo
570db8b9e6
Merge pull request #2265 from wpaulino/channel-force-closed-update-err
Prevent ChannelForceClosed monitor update error after detecting spend
2023-05-08 16:33:14 +00:00
Matt Corallo
818dbdf7ab
Merge pull request #2267 from TheBlueMatt/2023-05-better-scb-err
Mention lnd's SCB feature in the corresponding error message
2023-05-06 00:58:18 +00:00
Duncan Dean
2ace882d39
Add & generate dual-funding message fuzzing 2023-05-05 11:40:53 +02:00
Duncan Dean
4e9a358baa
Add new wire messaging and events but don't handle them 2023-05-05 11:40:51 +02:00
Duncan Dean
adc1b55a6f
Add message structs required for dual-funded channels
This is the first of a set of PRs to enable the experimental dual-funded
channels feature using interactive transaction construction. This allows
both the channel initiator and channel acceptor to contribute funds
towards the channel.
2023-05-05 11:40:49 +02:00
Matt Corallo
d8c0a2beab Docuemnt when PaymentPathFailed::payment_id is Some
The `PaymentPathFailed::payment_id` field has been `Some` since
the field was added in
73f601fd3d.
2023-05-05 04:08:55 +00:00
Matt Corallo
e1394f3ea0 Document when PaymentPathSuccessful::payment_hash is filled in.
The `payment_hash` field in `PaymentPathSuccessful` is always
`Some` as long as the pening payment tracker has a `payment_hash`,
which is true for all `Pending` payments as well as all `Fulfilled`
payments starting with the commit which added
`PaymentPathSuccessful` -
3b5c370b404e2f5a8f3c35093b97406f149a9340c177c05252574083d68df0da.
2023-05-05 03:33:54 +00:00
Wilmer Paulino
1aeb8216e1
Improve logging around redundant force close monitor updates 2023-05-04 17:46:13 -07:00
Matt Corallo
96ab759e11 Mention lnd's SCB feature in the corresponding error message
It's a bit confusing when we see only "Peer sent a garbage
channel_reestablish" when a peer uses lnd's SCB feature to ask us
to broadcast the latest state. This updates the error message to be
a bit clearer.
2023-05-05 00:13:25 +00:00
Wilmer Paulino
9878edeeba
Prevent ChannelForceClosed monitor update error after detecting spend
If we detected a spend for a channel onchain prior to handling its
`ChannelForceClosed` monitor update, we'd log a concerning error
message and return an error unnecessarily. The channel has already been
closed, so handling the `ChannelForceClosed` monitor update at this
point should be a no-op.
2023-05-04 15:22:25 -07:00
Matt Corallo
e94647ca4e
Merge pull request #2111 from TheBlueMatt/2023-03-sent-persist-order-prep
Setup Support for delaying `ChannelMonitorUpdate` flight until an `Event` completes
2023-05-04 21:26:44 +00:00
Wilmer Paulino
bb38ed3b2e
Merge pull request #2262 from Kixunil/remove-serde-error-allocation
Remove unneeded allocation
2023-05-04 10:30:32 -07:00
Valentine Wallace
cea78f585a
Error if clear hints are provided for blinded PaymentParams 2023-05-04 10:50:53 -04:00
Valentine Wallace
06eeefc5e7
Groundwork for refactoring PaymentParams::Hints to ::Payee
Minor changes in preparation for supporting route blinding in
PaymentParameters. In the next commit, we'll be moving more
unblinded-payee-specific fields from the top level parameters into the clear
enum variant.
2023-05-04 10:31:56 -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
Matt Corallo
56b0c96838
Merge pull request #2246 from arik-so/2023-04-sign-module
Move keysinterface.rs to a directory-level module called sign
2023-05-03 16:53:36 +00:00
Matt Corallo
ca1d569356
Merge pull request #2219 from benthecarman/custom-closing-address
Add ability to set shutdown script when closing channel
2023-05-03 16:33:57 +00:00
Arik Sosman
6cb9919f0c
Move keysinterface.rs to a directory-level module called sign. 2023-05-02 21:48:08 -07:00
Matt Corallo
ec3de62bc7
Merge pull request #2249 from TheBlueMatt/2023-04-less-pm-bounds
Trivial PeerManager cleanups
2023-05-03 01:41:17 +00:00
Matt Corallo
14c6810e48 Expose a trait impl'd for all PeerManager for use as a bound
A while back, in tests, we added a `AChannelManager` trait, which
is implemented for all `ChannelManager`s, and can be used as a
bound when we need a `ChannelManager`, rather than having to
duplicate all the bounds of `ChannelManager` everywhere.

Here we do the same thing for `PeerManager`, but make it public and
use it to clean up `lightning-net-tokio` and
`lightning-background-processor`.

We should likely do the same for `AChannelManager`, but that's left
as a followup.
2023-05-02 22:17:25 +00:00
Matt Corallo
b0d37edb30
Merge pull request #2253 from dunxen/2023-05-removeoptionalfield
Remove `OptionalField` and make `DataLossProtect` fields mandatory
2023-05-02 22:02:04 +00:00
benthecarman
12b59b2113
Add ability to set shutdown script when closing channel 2023-05-02 15:24:16 -05:00