Commit Graph

126 Commits

Author SHA1 Message Date
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
Matt Corallo
8164cb9307 Accept RPC responses with a null result
This is actually a valid response in some cases, at least for the
`gettxout` command, where `null` is returned if no corresponding
UTXO was found, but the command otherwise succeeded.
2023-07-28 19:01:34 +00:00
Gabor Szabo
1da6fc2ded http => https 2023-07-23 08:58:41 +03:00
Matt Corallo
983f2c1870 Bump crate versions to 0.0.116 release 2023-07-21 20:42:13 +00:00
Matt Corallo
cc5fea84e6 Update version numbers to rc1, from alpha1 2023-07-17 20:07:30 +00:00
Matt Corallo
23e9fc79fd Bump versions to LDK 116-alpha1 and invoice 24.0-alpha1 2023-06-23 19:43:26 +00:00
Wilmer Paulino
4f9bcb9958
Check difficulty transition against Target instead of Work
`rust-bitcoin v0.30.0` made some changes in this area that no longer
allow us to work with the previously exposed `U256` type. While `Work`
and `Target` (they're inverses of each other) essentially represent the
same concept, it makes more sense from their API's perspective to only
expose difficulty transitions and adjustments on `Target`s.
2023-05-10 11:39:46 -07:00
Arik Sosman
6cb9919f0c
Move keysinterface.rs to a directory-level module called sign. 2023-05-02 21:48:08 -07:00
Matt Corallo
fb424009e3 Bump crate versions to 0.0.115/invoice 0.23 2023-04-24 22:40:17 +00:00
Matt Corallo
9a50e301cb Avoid connection-per-RPC-call again by caching connections
In general, only one request will be in flight at a time in
`lightning-block-sync`. Ideally we'd only have one connection, but
without using the `futures` mutex type.

Here we solve this narrowly for the one-request-at-a-time case by
caching the connection and takeing the connection out of the cache
while we work on it.
2023-03-30 22:28:26 +00:00
Matt Corallo
6b55df93fb Drop futures dependency from lightning-block-sync
Some how I'd understood that `futures` had reasonable MSRV
guarantees (e.g. at least Debian stable), but apparently that isn't
actually the case, as they bumped it to upgrade to syn (with
apparently no actual features or bugfixes added as a result?) with
no minor version bump or any available alternative (unlike Tokio,
which does LTS releases).

Luckily its relatively easy to just drop the `futures` dependency -
it means a new connection for each request, which is annoying, but
certainly not the end of the world, and its easier than trying to
deal with pinning `futures`.

See https://github.com/rust-lang/futures-rs/pull/2733
2023-03-30 18:56:27 +00:00
Matt Corallo
b701a6c516 Drop serde dependency from lightning-block-sync
`serde` doesn't bother with MSRVs, so its expected to break
frequently. Yesterday, the `derive` feature had its MSRV broken in
a patch version without care.

Luckily its trivial for us to remove the `serde` dependency in
`lightning-block-sync`, using only `serde_json` for the JSON
deserialization part. It even ends up net-negative on LoC.
2023-03-20 16:31:22 +00:00
Elias Rohrer
73306a3503
Pin tokio to 1.26 on windows to fix CI 2023-03-12 14:12:21 +01:00
Matt Corallo
ccac926671
Merge pull request #2049 from douglaz/run-clippy-fix
Run clippy fix
2023-03-06 21:28:38 +00:00
Allan Douglas R. de Oliveira
57017dfc0b Run clippy --fix and cleanup code 2023-03-06 19:26:48 +00:00
Matt Corallo
a361be3544 Update crate versions to 0.0.114/invoice 0.22 2023-03-04 00:06:46 +00:00
Jeffrey Czyz
8408b8d0e4
Add more documentation about BlockSourceError
Some BlockSource implementations provide more error details. Document
this in case users want to examine it further.
2023-03-03 14:23:17 -06:00
John Cantrell
a7af24bf3c Surface bitcoind rpc error code
Users of the RpcClient had no way to access the error code
returned by bitcoind's rpc.  We embed a new RpcError struct
as the inner error for the returned io::Error. Users can access
both the code and the message using this inner struct.
2023-02-28 14:03:28 -05:00
Matt Corallo
358d980e64 Always set _test_utils when building lightning for some tests
This ensures that we hit additional assertions which are intended
to always be run in tests.
2023-01-17 23:47:45 +00:00
Arik Sosman
72183bd932
Split up generic parameters that used to comprise KeysInterface. 2023-01-12 16:10:35 -08:00
Arik Sosman
5824e226ca
Remove KeysInterface trait. 2023-01-12 09:18:08 -08:00
Valentine Wallace
2e06efe2ff
Parameterize ChannelManager by a Router trait
This will be used in upcoming work to fetch routes on-the-fly for payment
retries, which will no longer be the responsibility of InvoicePayer.
2023-01-03 15:34:14 -05:00
Matt Corallo
f96ac1d341 Bump crate versions to 0.0.113/invoice 0.21 2022-12-15 22:15:55 +00:00
Arik Sosman
1c8a06cf61
Remove generic Signer parameter where it can be inferred from KeysInterface 2022-11-09 16:15:11 -08:00
valentinewallace
2e343e78ca
Merge pull request #1797 from arik-so/2022-10-channel-manager-deparameterization
Deparametrize `ChannelManager` to infer `Signer` from its `KeysInterface`.
2022-10-26 13:32:09 -04:00
Arik Sosman
22c367b13b
Deparametrize ChannelManager to infer Signer from its KeysInterface. 2022-10-25 10:02:28 -07:00
Matt Corallo
35154a15c3 Bump crate versions to 0.0.112/invoice 0.20 2022-10-24 18:53:58 +00:00
Jeffrey Czyz
ee17faff90
Merge pull request #1777 from lexe-tech/max/best-block-header-best-block
Add `.to_best_block()` method to `ValidatedBlockHeader`
2022-10-19 08:46:07 -05:00
Max Fang
a9f8b6e052 Add ValidatedBlockHeader::to_best_block 2022-10-18 14:47:52 -07:00
Gabriel Comte
aa916bb594
Derive Eq for all structs that derive PartialEq 2022-10-14 13:24:02 +02:00