Commit graph

155 commits

Author SHA1 Message Date
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
cd0ca28945 Bump version numbers to 0.0.124-beta/invoice 0.32-beta 2024-08-20 00:29:12 +00:00
Arik Sosman
92aac2a2ae
Fix lightning-block-sync 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
Tobin C. Harding
eac1b87e65
Use bitcoin::hex instead of bitcoin::hashes::hex
Use the `hex-conservative` crate directly from `bitcoin` instead of from
`hashes`. Although it makes no real difference it is slightly more clear
and more terse.
2024-08-09 08:20:15 +10:00
Tobin C. Harding
aeee8fe31e
Remove explicit dependency on hex-conservative
The `hex` crate is re-exported by `rust-bitcoin` so we can get it from
there instead of explicitly depending on it. Doing so reduces the
maintenance burden and helps reduce the likelyhood of getting two
versions in the dependency graph.
2024-08-09 08:20:09 +10: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
7945af700d [block-sync] Don't hold client-cache lock while connecting
`lightning-block-sync`'s REST and RPC clients both hold a cache for
a connected client to avoid the extra connection round-trip on each
request. Because only one client can be using a connection at once,
the connection is `take()`n out of an `Option` behind a `Mutex` and
if there isn't one present, we call `HttpClient::connect` to build
a new one.

However, this full logic is completed in one statement, causing a
client-cache lock to be held during `HttpClient::connect`. This
can turn into quite a bit of contention when using these clients as
gossip verifiers as we can create many requests back-to-back during
startup.

I noticed this as my node during startup only seemed to be
saturating one core and managed to get a backtrace that showed
several threads being blocked on this mutex when hitting a Bitcoin
Core node over REST that is on the same LAN, but not the same
machine.
2024-07-21 23:29:19 +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
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
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
Jiri Jakes
a8bd4c097f
Upgrade rust-bitcoin to 0.31 2024-05-30 18:35:29 +08:00
Matt Corallo
49b375311b Bump crate versions to 0.0.123-beta/invoice 0.31-beta 2024-04-19 01:03:03 +00:00
Matt Corallo
ef2e739295 Remove a handful of redundant imports
... that newer rustc now warns about.
2024-04-05 09:05:56 +00:00
Arik Sosman
bb9b389be6
Improve error message for invalid response lengths. 2024-01-30 14:01:29 -08:00
Matt Corallo
7b31b303c6 Bump versions to LDK 0.0.121/invoice 0.29 2024-01-22 22:32:30 +00:00
Matt Corallo
37017ec39f Bump crate versions to 0.0.120/invoice 0.28 2024-01-17 21:34:29 +00:00
Elias Rohrer
cd5f09b8e3
Merge pull request #2822 from TheBlueMatt/2024-01-pm-dyn-ref
Drop `PeerManager` type bound on `UtxoLookup` entirely
2024-01-11 18:41:01 +01:00
Matt Corallo
370339919d Drop PeerManager type bound on UtxoLookup entirely
In 67659677d4 we relaxed the bounds
set on `UtxoLookup` to enable those using `RoutingMessageHandler`
other than `P2PGossipSync` to use `UtxoLookup`. Sadly, because this
requires having a concrete `PeerManager` type which does *not* use
`UtxoLookup` in the `RoutingMessageHandler` type, this broke users
who were directly using `P2PGossipSync`.

We could split `UtxoLookup` into two, with different bounds, for
the two use-cases, but instead here we simply switch to storing a
reference to the `PeerManager` via a `dyn Fn` which allows us to
wake the `PeerManager` when we need to.

Fixes #2813
2024-01-10 22:33:43 +00:00
Elias Rohrer
b923e1a6f5
Feature-gate GetUtxosResponse in lightning-block-sync
.. as it's only used by the REST client.
2023-12-18 08:53:27 +01:00
Matt Corallo
c6e4debee9 Bump versions to 0.0.119/lightning-invoice 0.27 2023-12-15 23:53:40 +00:00
olegkubrakov
6b3c2c6430 Fixes bug with incorrect conversion of JsonValue to Txid.
The bug happens when there is a call to a bitcoind that expects a transaction id as a response and
results in a corrupted Txid being returned.
2023-12-14 16:34:01 -08:00
olegkubrakov
348db3baf7 Update tokio version to the latest to avoid tokio versions with security bugs.
This commit will set tokio version requirement to >=1.35.0, <2.0.0 to avoid versions with security issues (https://rustsec.org/packages/tokio.html).
2023-12-13 10:37:58 -08:00
Elias Rohrer
ddf2509227
Bump MSRV to rustc 1.63.0 and edition to 2021
.. which is a reasonable common ground, also supported by Debian stable.
2023-12-08 14:03:45 +01:00
John Cantrell
67659677d4 simplify GossipVerifier types using APeerManager 2023-12-05 16:01:29 -05:00
Arik Sosman
27b9794bed
Rename SignerProvider's Signer to EcdsaSigner. 2023-11-27 16:27:20 -08:00
Wilmer Paulino
ec928d55b4
Bump rust-bitcoin to v0.30.2 2023-11-22 15:58:01 -08:00
Matt Corallo
b664875c1b Bump crate versions to lightning 0.0.118, invoice 0.26 2023-10-23 23:41:11 +00:00
Jeffrey Czyz
54f96ef944
Use ChainHash instead of BlockHash as applicable
ChainHash is more appropriate for places where an arbitrary BlockHash is
not desirable. This type was introduced in later versions of the bitcoin
crate, thus BlockHash was used instead.

Using ChainHash also makes it easier to check if ChannelManager is
compatible with an Offer.
2023-10-16 13:29:53 -05:00
Matt Corallo
631f989fb5 Replace lightning-block-sync test that depended on foo.com
Our tests should generally not rely on internet access, and should
not rely on the behavior of any given remote server. However, one
of the `endpoint_tests` in `lightning-block-sync::http` relied on
`foo.com` resolving to a single socket address, which both might
change in the future and makes our tests fail without internet.
2023-10-13 02:52:15 +00:00
Matt Corallo
c74874604e Bump crate versions to 0.0.117/invoice 0.25 2023-10-03 23:00:48 +00:00
Matt Corallo
7036681728 Bump crate versions to 0.0.117-rc1/invoice 0.25-rc1 2023-09-29 23:39:18 +00:00
Matt Corallo
94140b91d8 Bump versions to 0.0.117-alpha2/invoice 0.25.0-alpha2 2023-09-26 20:21:08 +00:00
Matt Corallo
e01b51db67 Update crate version numbers to 0.0.117-alpha1/invoice 0.25-alpha1 2023-09-21 20:27:12 +00:00
Matt Corallo
189c1fbe2c Fail UTXO lookups if the block doesn't have five confirmations
The BOLT spec mandates that channels not be announced until they
have at least six confirmations. This is important to enforce not
because we particularly care about any specific DoS concerns, but
because if we do not we may have to handle reorgs of channel
funding transactions which change their SCID or have conflicting
SCIDs.
2023-08-23 21:48:03 +00:00
Matt Corallo
3482fceeab Add a simple naive block cache in gossip sync lookups 2023-08-23 21:48:03 +00:00
Matt Corallo
01857b51a1 Implement the UtxoSource interface for REST/RPC clients
In LDK, we expect users operating nodes on the public network to
implement the `UtxoSource` interface in order to validate the
gossip they receive from the network.

Sadly, because the DoS attack of flooding a node's gossip store
isn't a common issue, and because we do not provide an
implementation off-the-shelf to make doing so easily, many of our
downstream users do not have a `UtxoSource` implementation.

In order to change that, here we implement an async `UtxoSource`
in the `lightning-block-sync` crate, providing one for users who
sync the chain from Bitcoin Core's RPC or REST interfaces.
2023-08-23 21:48:03 +00:00