Commit graph

772 commits

Author SHA1 Message Date
Alec Chen
e8939e26bc Allow toggling specific signing methods in test channel signer 2024-06-17 16:32:06 -07:00
Matt Corallo
07f33800a1
Merge pull request #3102 from tnull/2024-06-rustfmt-fuzz
`rustfmt`: Reformat the `fuzz` dir
2024-06-13 06:56:33 -07:00
Elias Rohrer
3ec0dcdac1
Merge pull request #3078 from jkczyz/2024-05-invoice-event
Asynchronous `Bolt12Invoice` payment
2024-06-13 08:25:59 +02:00
Jeffrey Czyz
a9dcfaf952
Add UserConfig::manually_handle_bolt12_invoices
BOLT12 invoices are automatically paid once they have been verified.
Users may want to manually pay them by first performing additional
checks. Add a manually_handle_bolt12_invoices configuration option that
when set generates an Event::InvoiceReceived instead of paying the
invoice.
2024-06-12 19:38:16 -05:00
Elias Rohrer
4e9ce52c72
rustfmt: fuzz/src/full_stack.rs 2024-06-12 21:53:32 +02:00
Elias Rohrer
945cb77247
Prepare fuzz/src/full_stack.rs for rustfmt 2024-06-12 21:53:32 +02:00
Elias Rohrer
0583f643b9
rustfmt: fuzz/src/chanmon_consistency.rs 2024-06-12 21:53:30 +02:00
Elias Rohrer
7b3e9a82f8
Introduce noret wrappers 2024-06-12 21:53:00 +02:00
Elias Rohrer
f0ec37ec16
Prepare chanmon_consistency.rs for rustfmt 2024-06-12 19:26:59 +02:00
Elias Rohrer
5e3056e988
Merge pull request #3113 from TheBlueMatt/2024-04-async-monitor-fuzz
Fuzz reloading with a stale monitor in chanmon_consistency
2024-06-12 19:20:28 +02:00
Matt Corallo
d5019fc4d8 Fuzz reloading with a stale monitor in chanmon_consistency
Now that we are gearing up to support fully async monitor storage,
we really need to fuzz monitor updates not completing before a
reload, which we do here in the `chanmon_consistency` fuzzer.

While there are more parts to async monitor updating that we need
to fuzz, this at least gets us started by having basic async
restart cases handled. In the future, we should extend this to make
sure some basic properties (eg claim/balance consistency) remain
true through `chanmon_consistency` runs.
2024-06-12 15:32:33 +00:00
Matt Corallo
5a1cc288b7 Force-close channels if their feerate gets stale without any update
For quite some time, LDK has force-closed channels if the peer
sends us a feerate update which is below our `FeeEstimator`'s
concept of a channel lower-bound. This is intended to ensure that
channel feerates are always sufficient to get our commitment
transaction confirmed on-chain if we do need to force-close.

However, we've never checked our channel feerate regularly - if a
peer is offline (or just uninterested in updating the channel
feerate) and the prevailing feerates on-chain go up, we'll simply
ignore it and allow our commitment transaction to sit around with a
feerate too low to get confirmed.

Here we rectify this oversight by force-closing channels with stale
feerates, checking after each block. However, because fee
estimators are often buggy and force-closures piss off users, we
only do so rather conservatively. Specifically, we only force-close
if a channel's feerate is below the minimum `FeeEstimator`-provided
minimum across the last day.

Further, because fee estimators are often especially buggy on
startup (and because peers haven't had a chance to update the
channel feerates yet), we don't force-close channels until we have
a full day of feerate lower-bound history.

This should reduce the incidence of force-closures substantially,
but it is expected this will still increase force-closures somewhat
substantially depending on the users' `FeeEstimator`.

Fixes #993
2024-06-10 15:17:58 +00:00
Matt Corallo
66e6ee563b Skip fee reads in full_stack_target when connecting many blocks
When we connect 100 blocks in a row, requiring the fuzz input to
contain 100 fee estimator results is uneccessary, so add a bool
that lets us skip those reads.
2024-06-10 15:12:50 +00:00
Elias Rohrer
5d0fb36477
rustfmt: src/utils/* 2024-06-07 20:42:36 +02:00
Elias Rohrer
0e7fe0c9aa
rustfmt: fuzz/src/router.rs 2024-06-07 20:42:36 +02:00
Elias Rohrer
64843ae633
rustfmt: fuzz/src/refund_deser.rs 2024-06-07 20:42:36 +02:00
Elias Rohrer
73ebb1bd1b
rustfmt: fuzz/src/process_network_graph.rs 2024-06-07 20:42:36 +02:00
Elias Rohrer
8e1a98183d
rustfmt: fuzz/src/peer_crypt.rs 2024-06-07 20:42:36 +02:00
Elias Rohrer
da99d521b9
rustfmt: fuzz/src/offer_deser.rs 2024-06-07 20:42:27 +02:00
Elias Rohrer
4741731dd3
rustfmt: fuzz/src/offer_deser.rs 2024-06-07 20:41:50 +02:00
Elias Rohrer
b9c52f6941
rustfmt: fuzz/src/msg_targets/* 2024-06-07 20:37:10 +02:00
Elias Rohrer
9db52b69bb
rustfmt: fuzz/src/lib.rs 2024-06-07 20:37:10 +02:00
Elias Rohrer
f1ac0a3d97
rustfmt: fuzz/src/invoice*.rs 2024-06-07 20:37:10 +02:00
Elias Rohrer
9164e835e5
rustfmt: fuzz/src/indexedmap.rs 2024-06-07 20:37:10 +02:00
Elias Rohrer
997e46bde2
rustfmt: fuzz/src/fromstr_to_netaddress.rs 2024-06-07 20:37:09 +02:00
Elias Rohrer
39cc28bfaa
rustfmt: fuzz/src/chanmon_deser.rs 2024-06-07 20:37:09 +02:00
Elias Rohrer
2bcdad779a
rustfmt: fuzz/src/bin/* 2024-06-07 20:37:09 +02:00
Elias Rohrer
c2abfbf5f5
rustfmt: fuzz/src/base32.rs 2024-06-07 20:37:09 +02:00
Elias Rohrer
b1a9410508
Add rustfmt::skip to the target template 2024-06-07 20:37:09 +02:00
Elias Rohrer
fde0d9e718
Add rustfmt::skip to the msg_target template 2024-06-07 20:37:08 +02:00
Jeffrey Czyz
5326171885
Refactor MessageRouter::create_blinded_paths
Using compact blinded paths isn't always necessary or desirable. For
instance, reply paths are communicated via onion messages where space
isn't a premium unlike in QR codes. Additionally, long-lived paths could
become invalid if the channel associated with the SCID is closed.
Refactor MessageRouter::create_blinded_paths into two methods: one for
compact blinded paths and one for normal blinded paths.
2024-06-05 17:52:30 -05:00
Elias Rohrer
15c709d747
Merge pull request #3089 from TheBlueMatt/2024-06-channel_state-module
Move the public channel state API into a new module
2024-06-04 16:28:39 +02:00
Matt Corallo
2d6d5cc86f Move the public path for channel_state types to their new path 2024-06-04 14:21:08 +00:00
Arik
993cd1e525
Merge pull request #2889 from Sharmalm/2840
Allow for user-specified error message during force close channel
2024-06-03 14:48:52 -07:00
Jiri Jakes
a8bd4c097f
Upgrade rust-bitcoin to 0.31 2024-05-30 18:35:29 +08:00
Jeffrey Czyz
e553a71b6f
Pass ForwardNode when creating BlindedPath
Instead of passing Vec<PublicKey> to MessageRouter::crate_blinded_path,
pass Vec<ForwardNode>. This way callers can include a short_channel_id
for a more compact BlindedPath encoding.
2024-05-28 16:35:55 -05:00
Jeffrey Czyz
d792afb08c
Support NextHop::ShortChannelId in BlindedPath
When sending an onion message to a blinded path, the short channel id
between hops isn't need in each hop's encrypted_payload since it is not
a payment. However, using the short channel id instead of the node id
gives a more compact representation. Update BlindedPath::new_for_message
to allow for this.
2024-05-28 16:35:41 -05:00
Jeffrey Czyz
38690bf50a
Merge pull request #2907 from shaavan/issue2882
Introduce ResponseInstructions for OnionMessage Handling
2024-05-08 17:32:41 -05:00
Matt Corallo
806b7f0e31
Merge pull request #3054 from TheBlueMatt/2024-04-fuzz-bolt11
Add fuzzing coverage for BOLT11 invoice deserialization
2024-05-08 13:24:31 -07:00
Matt Corallo
65ba75d500 Substantially increase coverage in BOLT11 deserialization fuzzer 2024-05-08 19:56:21 +00:00
Matt Corallo
d14ea82b5d Move existing BOLT11 fuzz test to the fuzz crate 2024-05-08 19:36:15 +00:00
shaavan
15d016ac52 Implement ResponseInstruction Usage in OnionMessage Handling
This commit integrates the newly introduced ResponseInstruction structs
and enums into the codebase for handling OnionMessage responses.
2024-05-08 17:57:57 +05:30
Matt Corallo
28d85af955 Fix the full_stack_target breakage test and doc feerate requests
When we added the additional deust exposure checks in
702196819e6445048b803574fcacef77d5ce8c9c we added several
additional feerate fetches which broke the `full_stack_target`
change-detection test.

This updates the hard-coded test to support the new feerate fetches
and also includes a comment on `FeeEstimator` to indicate that
users really need to be caching feerates as otherwise they'll slow
us down.
2024-05-07 16:51:38 +00:00
Gursharan Singh
c1125f00b3
Remove MonitorUpdateId from persist trait
MonitorUpdateId was an opaque abstraction for id's generated by
UpdateOrigin:Offchain and UpdateOrigin::ChainSync monitor updates.
It was mainly needed to map calls made to
ChainMonitor::channel_monitor_updated. We no longer track
UpdateOrigin::ChainSync MonitorUpdates and can directly use
ChannelMonitor::get_latest_update_id() for tracking
UpdateOrigin::Offchain monitor updates.
2024-04-26 20:28:55 -07:00
Lalitmohansharma1
d17e759d02 Allowing user-specified error message during force close channel
In this commit i added additional parameter `error_message` to
`force_close_sending_error`. This parameter will allow users to
configure error message and send to peers during the force closing
of channel.I have also updated the tests for this updated function.
2024-04-20 19:12:59 +05:30
Matt Corallo
195e666953
Merge pull request #2964 from jbesraa/prune-stale-chanmonitor
Add `archive_fully_resolved_monitors` to `ChainMonitor`
2024-04-18 14:39:43 -07:00
jbesraa
4b5504366b Add ChainMonitor::archive_fully_resolved_monitor_channels
Archives fully resolved channel monitors by adding them to a backup
  location and removing them from the primary storage & the monitor set.

  This is useful for pruning fully resolved monitors from the monitor
  set and primary storage so they are not reloaded on every new new
  block connection.

  We also add a new function, `archive_persisted_channel` to the
  `Persist` trait that writes the monitor to an archive storage and
  removes it from the primary storage.
2024-04-18 17:12:07 +00:00
Elias Rohrer
ec956516d1
Add ConfirmationTarget::OutputSpendingFee 2024-04-18 16:20:02 +02:00
Jeffrey Czyz
9f1ffab24c
Look up node id from scid in OnionMessenger
When forwarding onion messages, the next node may be represented by a
short channel id instead of a node id. Parameterize OnionMessenger with
a NodeIdLookUp trait to find which node is the next hop. Implement the
trait for ChannelManager for forwarding to channel counterparties.

Also use this trait when advancing a blinded path one hop when the
sender is the introduction node.
2024-04-15 10:58:30 -05:00
Jeffrey Czyz
7002180261
Generalize BlindedPath::introduction_node_id field
Allow using either a node id or a directed short channel id in blinded
paths. This allows for a more compact representation of blinded paths,
which is advantageous for reducing offer QR code size.

Follow-up commits will implement handling the directed short channel id
case in OnionMessenger as it requires resolving the introduction node in
MessageRouter.
2024-04-15 10:58:30 -05:00