Commit Graph

318 Commits

Author SHA1 Message Date
Gursharan Singh
608209ef19
Merge pull request #3359 from TheBlueMatt/2024-10-less-types-re-export
Remove deprecated re-exports
2024-10-18 14:35:49 -07:00
Matt Corallo
50b5a6efa7 Drop the Payment{Hash,Preimage,Secret} re-exports in lightning
These re-exports were deprecated in 0.0.124 in favor of the
`lightning::types::payment::*` paths, which we use here.
2024-10-15 14:33:03 +00:00
Elias Rohrer
6004ee55bc
Merge pull request #3363 from G8XSU/event-logging-2
Revert "Add logging around event processing."
2024-10-15 09:32:37 +02:00
G8XSU
21e90366a3
Revert "Add logging around event processing."
This reverts commit 85eb8145fb.
Logging here can be overly verbose and moreover in case of event
handling failure, we loop back without any added delay.
2024-10-14 11:28:29 -07:00
Matt Corallo
64c12431b7 Drop lightning::ln::features::* type aliases
These were deprecated in 0.0.124, and we drop them here in favor of
`lightning::types::features::*`.
2024-10-13 13:52:56 +00:00
Matt Corallo
ebde296abd Parse and handle DNSResolverMessages in OnionMessenger
This adds the requisite message parsing and handling code for the
new DNSSEC messages to `OnionMessenger`.
2024-09-30 16:19:33 +00:00
Jeffrey Czyz
04c51b380d
Parameterize ChannelManager with MessageRouter
ChannelManager is parameterized by a Router, which must also implement
MessageRouter. Instead, add a MessageRouter parameter such that the
Router and MessageRouter traits can be de-coupled. This simplifies using
something other than DefaultMessageRouter, which DefaultRouter currently
delegates to.
2024-09-23 12:21:35 +09:00
Elias Rohrer
545b037827
Drop no-std feature
We drop the `lightning/no-std` feature and just take
`hashbrown`,`possiblyrandom` and `libm` as required dependencies.
2024-09-18 09:07:58 +02:00
Elias Rohrer
3c1a5d3aa1
Re-add optional std feature dependencies to fix RGS and BP builds
We previously removed these, leading to failure to build under default
features including `std`.
2024-09-18 09:07:58 +02:00
G8XSU
85eb8145fb
Add logging around event processing.
Currently we don't have any visibility if BackgroundProcessor
takes considerably more of time to process events, adding logs
to help debug such issues.
2024-09-13 14:02:49 -07:00
Elias Rohrer
b172942a75
Refactor: Take their_node_id by value across all handler interfaces
In order to maintain interface consistency, we refactor all message
handler interfaces to take `PublicKey` rather than `&PublicKey`, as the
difference in efficiency should be negigible and the former is easier to
handle in binding languages.

Over time, we also want to move (no pun intended) towards all messaging
interfaces using move semantics, so dropping the reference for
`PublicKey` is the first step in this direction.
2024-09-11 19:19:38 +02:00
Matt Corallo
c9de257498 Update versions to 0.0.124 and invoice 0.32 types 0.1 release 2024-09-03 18:18:52 +00:00
Matt Corallo
856c980594 Bump versions to rc1 2024-08-29 19:40:09 +00:00
Matt Corallo
b7064808ac
Merge pull request #3268 from TheBlueMatt/2024-08-moar-feerate-categories
Split up `ConfirmationTarget` even more
2024-08-28 13:15:13 +00:00
Matt Corallo
3f23e3c288 Add a constructor and per-target override to TestFeeEstimator
This will allow us to test `ConfirmationTarget`s used in functional
tests by setting an override on just the target we expect to be
used.
2024-08-27 19:57:34 +00:00
Elias Rohrer
0d7ae8616b
Merge pull request #3193 from tnull/2024-07-2995-followups
#2995 followups
2024-08-22 09:55:17 +02:00
Elias Rohrer
1107dc2fec
Fix permissive test 2024-08-21 21:55:49 +02:00
Matt Corallo
636125e089 Bound Persister's WriteableScore by Deref
This makes the trait marginally more flexible, but more importantly
matches our normal structure which makes the bindings generator a
bit happier.
2024-08-21 13:48:19 +00:00
Matt Corallo
cd0ca28945 Bump version numbers to 0.0.124-beta/invoice 0.32-beta 2024-08-20 00:29:12 +00:00
Matt Corallo
5e37074246 Drop the no-std feature from BP and drop feature implications
Now that we don't have to have everything in our entire ecosystem
use the same `std`/`no-std` feature combinations we should start by
untangling our own features a bit.

This takes the first step by removing the `no-std` feature entirely
from the `lightning-background-processor` crate and removing most
feature implications on dependencies from the remaining `std`
feature.

It also addresses a CI oversight where we were not testing
`lightning-background-processor` without the `std` feature in CI at
all.
2024-08-19 15:09:40 +00:00
Arik Sosman
813202f554
Fix lightning-background-processor warnings.
Version 0.32.2 of `rust-bitcoin` deprecates a number of methods that
are commonly used in this project, most visibly `txid()`, which is
now called `compute_txid()`. This resulted in a lot of warnings, and
this commit is part of a series that seeks to address that.
2024-08-16 10:31:45 -07:00
Arik Sosman
176d2ad599
Upgrade rust-bitcoin to 0.32.2. 2024-08-16 10:31:45 -07:00
Matt Corallo
4950f3cfc8
Merge pull request #3214 from TheBlueMatt/2024-07-chan-by-val
Make `funding_transaction_generated` take a `ChannelId` by value
2024-08-12 00:40:16 +00:00
Matt Corallo
1d9d911d1c
Merge pull request #3194 from tnull/2024-07-om-event-notifier
Add `Notifier` to `OnionMessenger`
2024-08-08 17:04:32 +00:00
Elias Rohrer
2dd8c2b3de
Add Notifier to OnionMessenger 2024-08-08 09:10:41 +02:00
Tobin C. Harding
b02f3134d8
Run contrib/run-rustfmt.sh
No other changes other than those introduced by the script.
2024-08-08 07:17:18 +10:00
Tobin C. Harding
e9b20cee43
Do not use bitcoin::blockdata
The `rust-bitcoin` project is working towards making the public API
separate from the directory structure; eventually the
`bitcoin::blockdata` will go away, to make maintenance easier here stop
using the `blockdata` module.

Do not run the formatter, so as to make review easier. This patch was
created mechanically using:

search-and-replace bitcoin::blockdata bitcoin

and having defined

```bash
search-and-replace () {
        if (($# != 2))
        then
                echo "Usage: $0 <this> <that>"
                return
        fi
        local this="$1"
        local that="$2"
        for file in $(git grep -l "$this")
        do
                perl -pi -e "s/$this/$that/g" "$file"
        done
}
```
2024-08-08 07:13:26 +10:00
Matt Corallo
1ff249516d Make funding_transaction_generated take a ChannelId by value
`ChannelId` is just a 32-byte array, so there's not a lot of value
in passing it by reference to `funding_transaction_generated`,
which we fix here.

This is also nice for bindings as languages like Java can better
analyze whether the `ChannelManager` ends up with a reference to
the `ChannelId`.
2024-08-04 18:16:22 +00:00
Elias Rohrer
8599bc9784
Add simple test for event replaying 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
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
Duncan Dean
99aa6e27f6
Use native check-cfg lint in cargo beta
This uses the newly introduced conditional configuration checks that are
now configurable withint Cargo (beta).

This allows us to get rid of our custom python script that checks for
expected features and cfgs.

This does introduce a warning regarding the unknown lint in Cargo
versions prior to the current beta, but since these are not rustc errors,
they won't break any builds with the "-D warnings" RUSTFLAG.

Moving to this lint actually exposed the "strict" feature not being
present in the lightning-invoice crate, as our python script didnt
correctly parse the cfg_attr where it appeared.
2024-07-12 11:48:15 +02:00
Elias Rohrer
438515d2c4
rustfmt: Run on lightning-background-processor/src/lib.rs 2024-07-09 10:26:00 +02:00
Elias Rohrer
a60f7a7fcf
Prepare lightning-background-processor/src/lib.rs 2024-07-09 10:25:47 +02:00
Valentine Wallace
969578703d
Implement AsyncPaymentsMessageHandler for ChanMan and use everywhere
Dummy implementation for now. This avoids having to change a bunch of type
signatures in the future when we replace the dummy impl with a real one.
2024-06-25 16:40:35 -04:00
Valentine Wallace
e8f154dd3c
AsyncPaymentsMessageHandler trait for OnionMessenger
Add a trait for handling async payments messages to OnionMessenger. This allows
users to either provide their own custom handling for async payments messages
or rely on a version provided by LDK.
2024-06-20 14:24:03 -04:00
Matt Corallo
3cd1cb5946
Merge pull request #3060 from TheBlueMatt/2024-05-parallel-async-om-events
Add a parallel async event handler to OnionMessenger and pass it directly to BackgroundProcessor
2024-06-04 12:10:43 -07: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
Matt Corallo
f96fbdd361 f fix imports in BP 2024-06-03 18:51:28 +00:00
Matt Corallo
92bf460292 Switch to using the OnionMessenger directly in BP
When `OnionMessenger` first developed a timer and events interface,
we accessed the `OnionMessenger` indirectly via the `PeerManager`.
While this is a fairly awkward interface, it avoided a large pile
of generics on the background processor interfaces. However, since
we now have an `AOnionMessenger` trait, this concern is no longer
significant. Further, because we now want to use the built-in
`OnionMessenger` async event processing method, we really need a
direct referene to the `OnionMessenger` in the background
processor, which we add here optionally.
2024-06-03 18:51:28 +00:00
Jiri Jakes
a8bd4c097f
Upgrade rust-bitcoin to 0.31 2024-05-30 18:35:29 +08:00
Matt Corallo
e818c4b13f Move [u8; 32] wrapper types to a common module
The `PaymentHash`, `PaymentSecret`, `PaymentPreimage`, and
`ChannelId` types are all small wrappers around `[u8; 32]` and are
used throughout the codebase but were defined in the top-level
`ln/mod.rs` file and the relatively sparsely-populated
`ln/channel_id.rs` file.

Here we move them to a common `types` module and go ahead and
update all our in-crate `use` statements to refer to the new
module for bindings. We do, however, leave a `pub use` alias for
the old paths to avoid upgrade hassle for users.
2024-05-01 19:01:40 +00:00
Elias Rohrer
afb452a813
Make OutputSweeper::track_spendable_outputs fallible
.. as otherwise we might only log an error and continue if we fail to
persist the sweeper state.
2024-04-24 09:46:34 +02: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
49b375311b Bump crate versions to 0.0.123-beta/invoice 0.31-beta 2024-04-19 01:03:03 +00:00
Elias Rohrer
681106d23f
Add basic OutputSweeper test in BP
.. we simply check that the `OutputSweeper` generates a spending tx and
that the `TrackedSpendableOutput` is pruned once it reaches
`ANTI_REORG_DELAY`.
2024-04-18 16:20:03 +02:00
Jeffrey Czyz
d29e2ba949
Use AChannelManager in BackgroundProcessor
Replace instance of ChannelManager in BackgroundProcessor and in
Persister with AChannelManager. This reduces the number of type
parameters need in those types, which would need to be repeated in an
async version of Persister.
2024-03-23 17:02:28 -05:00
Jeffrey Czyz
5e56c5ed45
Fix indentation in doc example 2024-03-23 16:18:58 -05:00
Elias Rohrer
57911dcd41
Refactor BestBlock to expose inner fields rather than accessors
.. which is more idiomatic Rust, and easier to handle in (downstream)
bindings.
2024-03-07 11:02:23 +01:00
Matt Corallo
8157c01eab Never store more than one StdWaker per live Future
When an `std::future::Future` is `poll()`ed, we're only supposed to
use the latest `Waker` provided. However, we currently push an
`StdWaker` onto our callback list every time `poll` is called,
waking every `Waker` but also using more and more memory until the
`Future` itself is woken.

Here we fix this by removing any `StdWaker`s stored for a given
`Future` when it is `drop`ped or prior to pushing a new `StdWaker`
onto the list when `poll`ed.

Sadly, the introduction of a `Drop` impl for `Future` means we
can't trivially destructure the struct any longer, causing a few
methods to need to take `Future`s by reference rather than
ownership and `clone` a few `Arc`s.

Fixes #2874
2024-02-15 21:52:06 +00:00