Commit graph

6702 commits

Author SHA1 Message Date
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
Matt Corallo
ce2907f226
Merge pull request #2872 from tnull/2024-02-add-features-to-channel-pending
Expose `channel_type` in `Event::ChannelPending`
2024-02-05 19:58:51 +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
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
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
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
dunxen
cc43f9c261
Merge pull request #2864 from dunxen/2024-01-2797followups
Fix followups to PR2797
2024-02-01 10:19:13 +02: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
Elias Rohrer
8e472669a1
Rename PaymentForwarded::fee_earned_msat to total_fee_earned_msat 2024-01-31 13:22:20 +01:00
Valentine Wallace
2616f02016
Track min HTLC overpay separately from skimmed fees in test utils 2024-01-31 13:22:19 +01:00
Valentine Wallace
42490efa2c
Struct-ify claim_along_route args.
Lays groundwork to make claim_payment* test utils easier to adapt without
changing a million callsites.
2024-01-31 13:22:19 +01:00
Duncan Dean
361079d842
Fix followups to PR2797 2024-01-31 07:58:56 +02:00
Matt Corallo
5bf58f0d33
Merge pull request #2862 from arik-so/arik/2024/01/http-error-message-fix
Improve error message for invalid response lengths
2024-01-30 23:36:36 +00:00
Matt Corallo
a634fd1dad
Merge pull request #2780 from wpaulino/2691-follow-ups
2691 follow-ups
2024-01-30 23:21:42 +00:00
Matt Corallo
7f177bb6dd
Merge pull request #2797 from dunxen/2023-12-purgetochannelid
Remove `Outpoint::to_channel_id` method
2024-01-30 23:04:39 +00:00
Arik Sosman
bb9b389be6
Improve error message for invalid response lengths. 2024-01-30 14:01:29 -08:00
Duncan Dean
cf2c27800a
Remove Outpoint::to_channel_id method
To avoid confusion and for accuracy going forward, we remove this method
as it is inconsistent with channel IDs generated during V2 channel
establishment. If one wants to create a V1, funding outpoint-based
channel ID, then `ChannelId::v1_from_funding_outpoint` should be used
instead.

A large portion of the library has always made the assumption that having
the funding outpoint will always allow us to generate the channel ID.
This will not be the case anymore and we need to pass the channel ID along
where appropriate. All channels that could have been persisted up to this
point could only have used V1 establishment, so if some structures don't
store a channel ID for them they can safely fall back to the funding
outpoint-based version.
2024-01-30 12:30:26 +02:00
Wilmer Paulino
25ec63f70e
Enforce compile-time check for flag getters and setters
This ensures that we cannot define or use flag getters/setters on
`ChannelState` variants in which said flag is not valid.
2024-01-29 14:00:06 -08:00
Wilmer Paulino
9ab7a48ff1
Use clear helper on flags copy to mask off bits 2024-01-29 13:57:19 -08:00
Matt Corallo
51d9ee35e5
Merge pull request #2694 from Evanfeenstra/public-scid-utils
public scid utils
2024-01-25 01:52:13 +00:00
Matt Corallo
76fff953bd
Merge pull request #2697 from jkczyz/2023-10-offer-functional-tests
Functional tests for BOLT 12 Offers payment flow
2024-01-24 23:14:01 +00:00
Matt Corallo
4bab9c8393
Merge pull request #2844 from TheBlueMatt/2024-01-cut-121
Release 0.0.121
2024-01-22 23:55:35 +00:00
Matt Corallo
7b31b303c6 Bump versions to LDK 0.0.121/invoice 0.29 2024-01-22 22:32:30 +00:00
Matt Corallo
28619a5ced Add CHANGELOG entry for 0.0.121 2024-01-22 22:32:30 +00:00
Matt Corallo
15c9f5bd7c
Merge pull request #2841 from TheBlueMatt/2024-01-batch-deadlock
Fix deadlock when handling bad calls to `batch_funding.._generated`
2024-01-22 22:30:59 +00:00
Matt Corallo
444740cd6d
Merge pull request #2842 from jkczyz/2024-01-fix-peer-handler-unwrap
Fix panic when peer is mid-handshake
2024-01-22 22:30:56 +00:00
Jeffrey Czyz
7b8d018f1f
Remove unnecessary unwraps 2024-01-22 16:26:54 -06:00
Jeffrey Czyz
c7465bdb3e
Fix panic when peer is mid-handshake
Peer::their_node_id is set to Some during the handshake process.
However, df3ab2ee27 accesses the field
unconditionally, causing a panic. This may be triggered if a gossip
message is received mid-handshake from another peer or if the user calls
broadcast_node_announcement during this time. The latter tends to be
executed on a timer.

Ensure that Peer::their_node_id is only accessed once the handshake is
complete.
2024-01-22 15:35:47 -06:00
Matt Corallo
983ca37a97 Fix deadlock when handling bad calls to batch_funding.._generated
When handling calls to `batch_funding_transaction_generated` which
were missing outputs for one of the batch channels, we'd previously
deadlock when trying to clean up the now-closed channels. This
fixes that and adds a new test case for it.

Found by the full_stack_target fuzzer.
2024-01-22 21:22:54 +00:00
Evan Feenstra
9a665ca0b8 public scid utils 2024-01-21 11:20:52 -08:00
Elias Rohrer
6b0ba8c9f1
Merge pull request #2835 from TheBlueMatt/2024-01-cut-120
Change v0.0.120 release name
2024-01-19 21:41:51 +01:00
Matt Corallo
79affa0d51 Change v0.0.120 release name
"Un"blinded makes more sense, since the fuzzer was unblinded :)
2024-01-17 23:19:12 +00:00
Matt Corallo
5592378de2
Merge pull request #2834 from TheBlueMatt/2024-01-cut-120
Cut 0.0.120
2024-01-17 23:02:24 +00:00
Matt Corallo
37017ec39f Bump crate versions to 0.0.120/invoice 0.28 2024-01-17 21:34:29 +00:00
Matt Corallo
947850b1de Add CHANGELOG entry for 0.0.120 2024-01-17 21:34:29 +00:00
Matt Corallo
871db638f2
Merge pull request #2818 from valentinewallace/2024-01-blinded-path-retries
Avoid retrying over previously failed blinded paths
2024-01-17 21:21:36 +00:00
valentinewallace
a1759582ad
Merge pull request #2828 from TheBlueMatt/2024-01-crypto-module
Move cryptographic algorithms and utilities to a new `crypto` mod
2024-01-17 12:53:02 -05:00
Valentine Wallace
5c87f40f6b
Test that we won't retry over previously failed blinded paths. 2024-01-17 10:55:41 -05:00
Valentine Wallace
8fcfaeb8d5
Test util: separate out code to construct a blinded path. 2024-01-17 10:55:41 -05:00
Valentine Wallace
32ab7a9e4d
Avoid building routes over previously failed blinded payment paths. 2024-01-17 10:55:39 -05:00
Valentine Wallace
23ef2535d0
Store previously failed blinded paths on outbound payment failure.
Useful so we don't retry over these paths.
2024-01-17 10:44:38 -05:00
Valentine Wallace
5c5d691425
Persist previously failed blinded paths in RouteParameters.
Useful so we don't retry over these paths.
2024-01-17 10:44:33 -05:00