Commit graph

4698 commits

Author SHA1 Message Date
Matt Corallo
9125de22c5 Opportunistically skip log in update_claims_view_from_requests
On each block, for each `ChannelMonitor`, we log a status statement
in `OnChainTx::update_claims_view_from_requests`. This can add up
to quite a bit, and is generally not very interesting when we don't
actually do anything if there's no claims to bump.

Here we drop the log if we have no claims to work with, but retain
it if we process any claims.
2024-02-13 23:43:02 +00:00
Matt Corallo
aab5b102e4 Drop some "Channel does not qualify for a feerate change" logs
On a high-traffic/channel node, `Channel .* does not qualify for a
feerate change.*` is our most common log, and it doesn't provide
much useful information. It's logged in two cases - (a) where the
estimator feerate is less than the current channel feerate but not
by more than half twice and (b) where we'd like to update the
channel feerate but the peer is disconnected or channel not
available for updates.

Because these conditions can persist and we log them once a minute
the volume of logs can add up quickly. Here we simply remove the
log in case (a), though leave (b) as its anticipated to be somewhat
quieter and does indicate a persistent issue that should be
addressed (possibly by closing the channel).
2024-02-13 23:06:48 +00:00
Matt Corallo
96b141c503 Make peers sending gossip out of order logging less scary
Multiple times we've had users wonder why they see `Error handling
message from.*; ignoring: Couldn't find channel for update` in
their logs and wonder if its related to their channel
force-closing. While this does indicate a peer is sending us gossip
our of order (and thus misbehaving), its not relevant to channel
operation and the logged message and level should indicate that.

Thus, here, we move the level to Gossip and add "gossip" between
"handling" and "message" (so it reads "Error handling gossip
message from.*").

Fixes #2471
2024-02-13 23:06:38 +00:00
Matt Corallo
f98a652f11
Merge pull request #2816 from wpaulino/retryable-holder-sigs
Allow holder commitment and HTLC signature requests to fail
2024-02-13 21:22:55 +00:00
Elias Rohrer
0995de7fa8
Merge pull request #2892 from TheBlueMatt/2024-02-destination-eq
Add further standard derives to various onion message structs
2024-02-13 09:21:04 +01:00
Matt Corallo
6f02025246 Add further standard derives to various onion message structs 2024-02-12 23:54:14 +00:00
Elias Rohrer
0c2a715c01
Merge pull request #2888 from TheBlueMatt/2024-02-destination-eq
Implement `Debug`/`PartialEq`/`Eq` for `Destination`
2024-02-12 13:29:15 +01:00
Matt Corallo
71c0d56415 Implement Debug/PartialEq/Eq for Destination 2024-02-10 02:27:59 +00:00
Matt Corallo
ee34bcf2d6 Replace spaces with tabs in msgs.rs 2024-02-08 23:05:08 +00:00
Matt Corallo
5faca20934 Fix silent merge conflict introduced in d3ddf15357 2024-02-08 23:05:08 +00:00
Matt Corallo
c93b59e13d
Merge pull request #2871 from dunxen/2024-02-msgcommonfields
Combine common fields for OpenChannel and AcceptChannel V1 & V2
2024-02-08 21:50:27 +00:00
Wilmer Paulino
e38dccaef4
Allow holder commitment and HTLC signature requests to fail
As part of the ongoing async signer work, our holder signatures must
also be capable of being obtained asynchronously. We expose a new
`ChannelMonitor::signer_unblocked` method to retry pending onchain
claims by re-signing and rebroadcasting transactions. Unfortunately, we
cannot retry said claims without them being registered first, so if
we're not able to obtain the signature synchronously, we must return the
transaction as unsigned and ensure it is not broadcast.
2024-02-07 15:44:23 -08:00
Wilmer Paulino
043ab75bb4
Introduce FeerateStrategy enum for onchain claims
This refactors the existing `force_feerate_bump` flag into an enum as we
plan to introduce a new flag/enum variant in a future commit.
2024-02-07 15:42:28 -08:00
Wilmer Paulino
71b4bd0811
Rework get_latest_holder_commitment_txn to broadcast for users
This method is meant to be used as a last resort when a user is forced
to broadcast the current state, even if it is stale, in an attempt to
claim their funds in the channel. Previously, we'd return the commitment
and HTLC transactions such that they broadcast them themselves. Doing so
required a different code path, one which was not tested, to obtain
these transactions than our usual path when force closing. It's not
worth maintaining both, and it's much simpler for us to broadcast
instead.
2024-02-07 15:42:26 -08:00
Valentine Wallace
fff1aa7cb0
Add min_final_cltv_delta to aggregated CLTV delta.
The spec was previously missing this requirement.
2024-02-07 12:02:26 -05:00
Valentine Wallace
fa44185ba8
Parameterize BlindedPath::new_for_payment by min final CLTV delta.
Currently we are not including this value in the aggregated CLTV delta, which
is wrong.
2024-02-07 12:02:24 -05:00
Elias Rohrer
bf4c7292c6
Impl Sync and Send for TestStore 2024-02-07 12:56:06 +01:00
Elias Rohrer
a85d5b1444
Add blanket Persist/Persister impls for dyn KVStore + Send + Sync
Previously, we only had blanket impls for `KVStore`. However, in order
to enable the use of `dyn KVStore + Send + Sync` instead of a `KVStore`
generic, we here also add the corresponding blanket implementations for
said type signature.
2024-02-07 12:56:06 +01:00
Matt Corallo
a9d73c2889
Merge pull request #2873 from tnull/2024-02-expose-channel-details-in-bte
Expose `channel_id` / `counterparty_node_id` in `BumpTransaction` event
2024-02-07 00:57:01 +00:00
Elias Rohrer
5b5c87464a
Expose channel_id / counterparty_node_id in BumpTransaction event
A client node might choose not to handle `Event::BumptTransaction`
events and leave bumping / Anchor output spending to a trusted
counterparty.

However, `Event::BumptTransaction` currently doesn't offer any clear
indication what channel and/or counterparty it is referring to. In order
to allow filtering these events, we here expose the `channel_id` and
`counterparty_node_id` fields.
2024-02-06 21:02:33 +01:00
Matt Corallo
d1c2e143fe Note when new HTLC state can be None 2024-02-06 18:53:56 +00:00
Matt Corallo
8296515871 Fix comment spelling 2024-02-06 18:53:04 +00:00
Matt Corallo
4a7ba675d4
Merge pull request #2442 from wvanlint/list_pending_htlcs
Include pending HTLC's in ChannelDetails
2024-02-06 18:45:36 +00:00
Elias Rohrer
a0917e50e8
Merge pull request #2876 from TheBlueMatt/2024-02-2863-doc-nits
Minor doc nits on the new coop close reason variants
2024-02-06 11:44:32 +01:00
Willem Van Lint
67e788eaa7 Include pending HTLCs in ChannelDetails
This exposes details around pending HTLCs in ChannelDetails.  The state
of the HTLC in the state machine is also included, so it can be
determined which protocol message the HTLC is waiting for to advance.
2024-02-05 17:35:54 -08:00
Matt Corallo
e64342afab
Merge pull request #2810 from TheBlueMatt/2023-12-arbitrary-fuzz-config
Update `full_stack_target` to take an arbitrary config object
2024-02-05 23:53:06 +00:00
Matt Corallo
e594021052
Merge pull request #2847 from TheBlueMatt/2024-01-bindings-upstream
Misc Tweaks for bindings
2024-02-05 23:49:19 +00:00
Matt Corallo
bad2efb73c Minor doc nits on the new coop close reason variants 2024-02-05 23:47:36 +00:00
Matt Corallo
8d9d099bf8
Merge pull request #2725 from shaavan/issue2096
Ensure successful message propagation in case of disconnection mid-handshake
2024-02-05 23:44:36 +00:00
Matt Corallo
f70c113fd8
Merge pull request #2863 from benthecarman/breakup-coop-close
Breakup CooperativeClosure into Local/Remote initiated
2024-02-05 23:43:26 +00:00
Elias Rohrer
2e61d92044
Expose channel_type in Event::ChannelPending
It is useful to immediately know what kind of channel is being opened,
and not having to wait until `ChannelReady`.
2024-02-05 14:32:33 +01:00
benthecarman
efcb5d9d0f
Rename old CooperativeClosure to LegacyCooperativeClosure 2024-02-04 16:33:28 +00:00
benthecarman
58f7942e11
Breakup CooperativeClosure into Local/Remote initiated 2024-02-04 16:33:27 +00:00
Matt Corallo
c9e4410a05 Fix test variable typos 2024-02-02 18:05:09 +00:00
Matt Corallo
dedc8306f6 Bump hashbrown dependency to 0.13
While this isn't expected to materially improve performance, it
does get us ahash 0.8, which allows us to reduce fuzzing
randomness, making our fuzzers much happier.

Sadly, by default `ahash` no longer tries to autodetect a
randomness source, so we cannot simply rely on `hashbrown` to do
randomization for us, but rather have to also explicitly depend on
`ahash`.
2024-02-02 18:05:08 +00:00
Matt Corallo
efbaa41fae Stop relying on Hash{Set,Map}::from_iter directly
In the next commit we'll bump the `hashbrown` version, which no
longer randomizes its hasher by default. Thus, we'll need to call
a different constructor in no-std builds from std builds.

Here we do a quick prefactor to use wrappers for `FromIterator`
constructors instead of calling the tables directly to make the
version bump changeset smaller.
2024-02-02 18:04:51 +00:00
Matt Corallo
3e0d55bd2b Use utility methods to construct HashMaps and HashSets
In the next commit we'll bump the `hashbrown` version, which no
longer randomizes its hasher by default. Thus, we'll need to call
a different constructor in no-std builds from std builds.

Here we do a quick prefactor to use wrappers for constructors
instead of calling the tables directly to make the version bump
changeset smaller.
2024-02-02 18:04:51 +00:00
Matt Corallo
f62a96ea93 Use arbitrary config object in full_stack_target fuzzer
As we've added more and more configuration parameters which change
our behavior, we're increasingly missing coverage in the general
`full_stack_target` fuzzer. Sadly, a reachable `unwrap` slipped in
uncaught that should have been stopped by the `full_stack_target`.

Here, we update the `full_stack_target` fuzzer to read a full
config object to substantially increase coverage.
2024-02-02 18:04:51 +00:00
Matt Corallo
248e2f5be5 Disable fuzzing-reachable debug assertions in ChannelMonitors 2024-02-02 18:04:51 +00:00
Matt Corallo
c7258426cd Disable fuzzing-reachable debug assertion
Because of txid conflicts, a txid can match both a local and remote
commitment transaction when fuzzing. Thus, we disable this
assertion when fuzzing.
2024-02-02 18:04:51 +00:00
Jeffrey Czyz
7c9463668a
Merge pull request #2868 from orbitalturtle/export-send-onion-path
export send_onion_message_using_path for testing
2024-02-02 11:18:24 -06:00
Matt Corallo
4d993c06b4
Merge pull request #2870 from benthecarman/pub-source-target
Make DirectedChannelInfo `source` and `target` public
2024-02-02 17:08:52 +00:00
Duncan Dean
0a7a5f9538
Combine common fields of AcceptChannel & AcceptChannelV2 into struct 2024-02-02 18:32:16 +02:00
benthecarman
a931decbbb
Make DirectedChannelInfo source and target public
We use these params for our HubPreferentialScorer and without these
utility functions then we have to manually do this and calculate which
is the source and which is the target node.
2024-02-02 14:14:51 +00:00
Duncan Dean
d3ddf15357
Combine common fields of OpenChannel & OpenChannelV2 into struct 2024-02-02 14:39:42 +02:00
Orbital
06f9dd7e83
export send_onion_message_using_path for testing 2024-02-01 20:22:53 -06:00
valentinewallace
3751398518
Merge pull request #2858 from tnull/2024-01-expose-skimmed-fee-msat
Expose withheld amount for underpaying HTLCs in `PaymentForwarded`
2024-02-01 09:42:22 -05:00
Elias Rohrer
96445880f6
Expose skimmed_fee_msat in PaymentForwarded
We generally allow routing nodes to forward less than the expected HTLC
amount, if the receiver knowingly accepts this and claims the
underpaying HTLC (see `ChannelConfig::accept_underpaying_htlcs`). This
use case is in particular useful for the LSPS2/JIT channel setting where
the intial underpaying HTLC pays for the channel open.

While we previously exposed the withheld amount as
`PaymentClaimable::counterparty_skimmed_fee_msat` on the receiver side,
we did not individually provide it on the forwarding node's side.
Here, we therefore expose this additionally withheld amount via
`PaymentForwarded::skimmed_fee_msat`.
2024-02-01 09:21:15 +01:00
shaavan
a6a6b48102 Add tests to check the introduced behaviour
- The first test make sure that the OutboundV1Channel is not
immediately removed when peers disconnect, but is removed after N timer
ticks.
- The second test makes sure that the SendOpenChannel is rebroadcasted
for the OutboundV1Channel if peer reconnects within time.
2024-01-31 18:00:03 +05:30
shaavan
ddf75afd16 Do not remove Outbound Channel immediately when peer disconnects
- Do not remove channel immediately when peer_disconnect, instead
  removed it after some time if peer doesn't reconnect soon (handled in
previous commit).
- Do not mark per ok_to_remove if we have some OutboundV1Channels too.
- Rebroadcast SendOpenChannel for outboundV1Channel when peer
  reconnects.
- Update the relevant tests to account for the behavior change.
- Repurpose the test_disconnect_in_funding_batch to test that all
  channels in the batch close when one them closes.
2024-01-31 17:59:50 +05:30