Commit graph

7511 commits

Author SHA1 Message Date
Matt Corallo
036c31c9d0 Ensure ChannelMonitorUpdates are ordered with full monitor writes
When we update a channel, then while connecting a block persist a
full `ChannelMonitor` prior to persisting the
`ChannelMonitorUpdate`, users can end up seeing a full
`ChannelMonitor` with a given `latest_update_id` prior to seeing
the `ChannelMonitorUpdate` with the same `update_id`. This
could cause users to have a full `ChannelMonitor` on disk as well
as a `ChannelMonitorUpdate` which was already applied. While this
isn't an issue for the LDK-provided update-based `Persist`, its
somewhat surprising for users so we avoid it.
2024-07-20 23:05:46 +00:00
Matt Corallo
9ce3dd5269
Merge pull request #3152 from alecchendev/2024-06-async-commit-secret-raa
Handle fallible commitment secret
2024-07-18 15:17:57 +00:00
Matt Corallo
2bfddea062
Merge pull request #2995 from tnull/2024-04-fallible-event-handler
Make event handling fallible
2024-07-18 15:07:07 +00:00
Elias Rohrer
e617a394e8
Document Failure Behavior and Persistence for every event type 2024-07-18 15:54:21 +02:00
Elias Rohrer
8599bc9784
Add simple test for event replaying 2024-07-18 15:54:21 +02:00
Elias Rohrer
f5cea0e57a
Handle fallible events in OnionMessenger
Previously, we would just fire-and-forget in `OnionMessenger`'s event
handling. Since we now introduced the possibility of event handling
failures, we here adapt the event handling logic to retain any
events which we failed to handle to have them replayed upon the next
invocation of `process_pending_events`/`process_pending_events_async`.
2024-07-18 15:54:21 +02:00
Elias Rohrer
018908fe9e
Make event handling fallible
Previously, we would require our users to handle all events
successfully inline or panic will trying to do so. If they would exit
the `EventHandler` any other way we'd forget about the event and
wouldn't replay them after restart.

Here, we implement fallible event handling, allowing the user to return
`Err(())` which signals to our event providers they should abort event
processing and replay any unhandled events later (i.e., in the next
invocation).
2024-07-18 15:54:21 +02:00
Elias Rohrer
b5b57f188f
Hold sep. Mutexes for pending intercepted_msgs/peer_connected events
This is a minor refactor that will allow us to access the individual
event queue Mutexes separately, allowing us to drop the locks earlier
when processing them individually.
2024-07-18 09:05:43 +02:00
Matt Corallo
0cfe55c007
Merge pull request #3160 from TheBlueMatt/2024-07-better-enum-upgradable-ser
Make `impl_writeable_tlv_based_enum*` actually upgradable
2024-07-17 18:05:22 +00:00
Alec Chen
34130327c5 Test fallible commitment secret 2024-07-17 10:57:51 -07:00
Matt Corallo
012bc50108
Merge pull request #3187 from TheBlueMatt/2024-07-routing-nits
#2803 nits
2024-07-17 17:12:00 +00:00
Matt Corallo
c3c909b369
Merge pull request #3136 from tnull/2024-06-rustfmt-lightning-block-sync
Run `rustfmt` on `lightning-block-sync`
2024-07-17 15:51:42 +00:00
Matt Corallo
1d1f47c45a Add pending changelog entry for the previous commit 2024-07-17 15:02:13 +00:00
Matt Corallo
72f883e0a1 Make impl_writeable_tlv_based_enum* actually upgradable
In cc78b77c71 it was discovered that
`impl_writeable_tlv_based_enum_upgradable` wasn't actually
upgradable - tuple variants weren't written with length-prefixes,
causing downgrades with new tuple variants to be unreadable by
older clients as they wouldn't know where to stop reading.

This was fixed by simply assuming that any new variants will be
non-tuple variants with a length prefix, but no code write-side
changes were made, allowing new code to freely continue to use the
broken tuple-variant serialization.

Here we address this be defining yet more serialization macros
which aren't broken, and convert existing usage of the existing
macros using non-length-prefixed tuple variants to renamed
`*_legacy` macros.

Note that this changes the serialization format of
`impl_writeable_tlv_based_enum[_upgradable]` when tuple fields are
written, and as such deliberately changes the call semantics for
such tuples.

Only the serialization format of `MessageContext` is changed here
which is fine as it has not yet reached a release of LDK.
2024-07-17 15:02:13 +00:00
Matt Corallo
7282aa7a8d Drop excess ()s in router.rs 2024-07-17 14:09:47 +00:00
Matt Corallo
63ecd902db Marginally improve comments around cache lines in gossip.rs 2024-07-17 14:09:47 +00:00
Matt Corallo
ac1463b120
Merge pull request #2803 from TheBlueMatt/2023-12-routing-dist-vec
Misc routing optimization
2024-07-17 14:06:05 +00:00
Alec Chen
5b3d6eabce Handle fallible release_commitment_secret 2024-07-16 15:49:59 -07:00
Matt Corallo
6ed398d42a
Merge pull request #3087 from shaavan/reply_path_diversity
Allow blinded path diversification by expanding `create_blinded_paths`
2024-07-16 19:29:08 +00:00
Matt Corallo
dee3ba7d6a
Merge pull request #3185 from tnull/2024-07-clarify-max-description-length
Clarify maximum length of an invoice description
2024-07-16 08:24:45 -07:00
Matt Corallo
6e73c37657
Merge pull request #3183 from TheBlueMatt/2024-07-no-strict
Drop unnecessary `strict` feature from `lightning-invoice`
2024-07-16 06:31:52 -07:00
Matt Corallo
17d5baa67f
Merge pull request #3150 from alecchendev/2024-06-async-commit-point-raa
Handle fallible per commitment point for RAA
2024-07-16 06:30:57 -07:00
Elias Rohrer
fa7ecc56d7
Clarify maximum length of an invoice description
We previously stated in the docs that the invoice description can be at most `1023`
bytes long, which is wrong. According to BOLT 11 it's at most 1023*5 bits (639 bytes) long.
2024-07-16 10:28:58 +02:00
Alec Chen
45c0a0f10c Test async get per commitment point for revoke_and_ack
Note: this does not test the CS -> RAA resend ordering, because this
requires handling async get_per_commitment_point for channel
reestablishment, which will be addressed in a follow up PR.
2024-07-15 14:28:23 -07:00
Alec Chen
614da40f19 Allow failing revoke_and_ack if commitment point is not available 2024-07-15 14:28:21 -07:00
Alec Chen
1f7f3a366c Change get_per_commitment_point to return result type
Includes simple changes to test util signers and tests, as well as
handling the error case for get_per_commitment_point in
HolderCommitmentPoint. This leaves a couple `.expect`s in places
that will be addressed in a separate PR for handling funding.
2024-07-15 14:28:17 -07:00
Matt Corallo
4bd4f19526
Merge pull request #3165 from Harshit933/link-fix
Fixes `Sensei` broken link
2024-07-15 12:17:09 -07:00
Alec Chen
1fa67d9434 Add logger as parameter in creating ChannelContext 2024-07-15 11:41:22 -07:00
Alec Chen
9c2a050a35 Return an error if we fail to advance our commitment number 2024-07-15 11:41:19 -07:00
Matt Corallo
e0f797460e Drop unnecessary strict feature from lightning-invoice
99aa6e27f6 detected that we had an
undefined feature in `lightning-invoice` called `strict`, which was
used to turn on `deny(warnings)`. It resolved that by adding the
feature to the `Cargo.toml`, but we actually don't need it - our CI
already builds with `-Dwarnings`, so any warnings should be
rejected during CI and there's not a lot of value in having a
(public) feature to do the same.
2024-07-15 18:34:31 +00:00
Matt Corallo
ddb40bd04c
Merge pull request #3173 from dunxen/2024-07-cargocheckcfg
Use native check-cfg lint in cargo beta
2024-07-15 11:33:08 -07:00
Alec Chen
516e5e6f58 Split HolderCommitmentPoint::advance off into separate function 2024-07-15 11:30:37 -07:00
Matt Corallo
161c40ffbb
Merge pull request #3180 from tnull/2024-07-use-upstreamed-merkle-validation
Electrum: Use upstreamed `validate_merkle_proof`
2024-07-15 11:16:40 -07:00
valentinewallace
3dedbd5ecb
Merge pull request #3172 from tnull/2024-07-revert-gossip-query-patch
Revert "Signal `GossipQuery` support when using `IgnoringMessagHandler`"
2024-07-15 13:39:54 -04:00
Elias Rohrer
b3a58e6db6
Use upstreamed validate_merkle_proof
We previously upstreamed the `validate_merkle_proof` utility method,
which shipped with `electrum-client` 0.19.0.

Since we upgraded to that version recently, we can now drop our local
code and use the upstreamed version.
2024-07-15 14:19:57 +02:00
Elias Rohrer
12e4efa0ff
Drop lightning-background-processor/src/lib.rs from exclusion list
We previously forgot to drop it (or it snuck back in during rebasing),
so we drop `lightning-background-processor` from the rustfmt exclusion
list.
2024-07-15 13:55:48 +02:00
Elias Rohrer
5e163da8d4
rustfmt: Drop lightning-custom-message/src/lib.rs from excluded
.. files
2024-07-15 13:55:39 +02:00
Elias Rohrer
9c2f4cb6ce
rustfmt: Run on lightning-block-sync/src/lib.rs 2024-07-15 13:55:39 +02:00
Elias Rohrer
43abde8d73
rustfmt: Run on lightning-block-sync/src/utils.rs 2024-07-15 13:55:39 +02:00
Elias Rohrer
ad7021ae30
rustfmt: Run on lightning-block-sync/src/test_utils.rs 2024-07-15 13:55:39 +02:00
Elias Rohrer
3ef5f18ebb
rustfmt: Run on lightning-block-sync/src/rpc.rs 2024-07-15 13:55:38 +02:00
Elias Rohrer
634821a95d
rustfmt: Run on lightning-block-sync/src/rest.rs 2024-07-15 13:55:38 +02:00
Elias Rohrer
26cacb60b5
rustfmt: Run on lightning-block-sync/src/poll.rs 2024-07-15 13:55:38 +02:00
Elias Rohrer
fb57e04057
rustfmt: Run on lightning-block-sync/src/init.rs 2024-07-15 13:55:38 +02:00
Elias Rohrer
310ad9a0eb
rustfmt: Run on lightning-block-sync/src/http.rs 2024-07-15 13:55:38 +02:00
Elias Rohrer
8975979fcd
rustfmt: Run on lightning-block-sync/src/gossip.rs 2024-07-15 13:55:38 +02:00
Elias Rohrer
16614963c1
Prepare lightning-block-sync/src/gossip.rs 2024-07-15 13:55:38 +02:00
Elias Rohrer
20669aeb71
rustfmt: Run on lightning-block-sync/src/convert.rs 2024-07-15 13:55:37 +02:00
Elias Rohrer
2f9bdc729c
Prepare convert.rs 2024-07-15 13:55:37 +02:00
Matt Corallo
dd5d297d64
Merge pull request #3138 from tnull/2024-06-rustfmt-bp
`rustfmt`: Run on `lightning-background-processor`
2024-07-14 11:15:13 -07:00