Commit Graph

71 Commits

Author SHA1 Message Date
Elias Rohrer
99ae425cad
Update lightning-transaction-sync to use macros crate 2024-10-17 16:26:42 +02:00
Matt Corallo
35bc575cd8 Reduce features on lightning-transaction-sync's tokio dev-dep
This should marginally reduce the chance of MSRV or other issues in
the future, and is just good practice.
2024-09-08 21:42:36 +00:00
Elias Rohrer
c15968c5f4
Add copyright notices to lightning-transaction-sync modules 2024-09-04 13:02:45 +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
cd0ca28945 Bump version numbers to 0.0.124-beta/invoice 0.32-beta 2024-08-20 00:29:12 +00:00
Arik Sosman
9914fd4f8d
Fix lightning-transaction 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
Elias Rohrer
3e1c9e7059
Drop electrsd autodownload feature for good
... which requires a bunch of unnecessary dev dependencies, e.g., `zip`.

Instead we lean on the `download_bitcoind_electrs.sh` script also for
local testing.
2024-08-13 08:50:29 +02:00
Matt Corallo
77f8af07ae
Merge pull request #3215 from tnull/2024-08-protect-against-merkle-leaf-node-weakness
tx-sync: Protect against Core's Merkle leaf node weakness
2024-08-08 16:10:18 +00:00
Elias Rohrer
44a479e2ae
Protect against Core's Merkle leaf node weakness
Bitcoin Core's Merkle tree implementation has no way to discern between
internal and leaf node entries. As a consequence it is susceptible to an
attacker injecting additional transactions by crafting 64-byte
transactions matching an inner Merkle node's hash (see
https://web.archive.org/web/20240329003521/https://bitslog.com/2018/06/09/leaf-node-weakness-in-bitcoin-merkle-tree-design/).

To protect against this (highly unlikely attack vector), we check that
the transaction isn't 64 bytes in length, and skip it otherwise.
2024-08-08 14:35:33 +02: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
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
Elias Rohrer
b3a58e6db6
Use upstreamed validate_merkle_proof
We previously upstreamed the `validate_merkle_proof` utility method,
which shipped with `electrum-client` 0.19.0.

Since we upgraded to that version recently, we can now drop our local
code and use the upstreamed version.
2024-07-15 14:19:57 +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
Elias Rohrer
21fee20a6d
rustfmt: lightning-transaction-sync/tests/integration_tests.rs 2024-06-07 16:54:30 +02:00
Elias Rohrer
85a82045fe
rustfmt: Reformat lightning-transaction-sync/src/lib.rs 2024-06-07 11:35:15 +02:00
Elias Rohrer
915fe195ca
rustfmt: Reformat lightning-transaction-sync/src/error.rs 2024-06-07 11:35:15 +02:00
Elias Rohrer
c5cd801f87
rustfmt: Reformat lightning-transaction-sync/src/esplora.rs 2024-06-07 11:35:15 +02:00
Elias Rohrer
470085aa2f
rustfmt: Reformat lightning-transaction-sync/src/electrum.rs 2024-06-07 11:35:15 +02:00
Elias Rohrer
3ead26323e
rustfmt: Reformat lightning-transaction-sync/src/common.rs 2024-06-07 11:35:15 +02:00
Elias Rohrer
777ce7b059
Make confirmables Deref
.. the bindings branch needed a small patch as it doesn't support `dyn`
traits. Here, we opt to use `Deref` in the hopes this works with
bindings, rendering the patch unnecessary.
2024-06-06 09:18:04 +02:00
Matt Corallo
4ec286979c Mark BDK types exported from transaction-sync as no-export 2024-06-05 14:46:08 +00: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
Elias Rohrer
b71c6e2f67
Dedup confirmed_txs Vec
Previously, we would just push to the `confirmed_txs` `Vec`, leading to
redundant `Confirm::transactions_confirmed` calls, especially now that
we re-confirm previously disconnected spends.

Here, we ensure that we don't push additional `ConfirmedTx` entries if
already one with matching `Txid` is present. This not only gets rid of
the spurious `transactions_confirmed` calls (which are harmless), but
more importantly saves us from issuing unnecessary network calls, which
improves latency.
2024-03-21 17:41:26 +01:00
Elias Rohrer
2f581104b2
Track spent WatchedOutputs and re-add if unconfirmed
Previously, we would track a spending transaction but wouldn't account
for it being reorged out of the chain, in which case we wouldn't monitor
the `WatchedOutput`s until they'd be reloaded on restart.

Here, we keep any `WatchedOutput`s around until their spends are
sufficiently confirmed and only prune them after `ANTI_REORG_DELAY`.
2024-03-19 15:55:28 +01:00
Elias Rohrer
a386ba5314
Disable lightning-transaction-sync integration tests on Windows
.. as the `electrsd` crate doesn't support it.

While we previously did so in our CI script, we now also `cfg`-gate the
tests and dependencies for easier handling.
2024-02-12 10:42:07 +01: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
2bd12137a4
Feature-gate time use also in ElectrumSyncClient
A previous commit introduced the `time` feature to gate the use of
`SystemTime` dependent APIs in `EsploraSyncClient`. It however omitted
doing the same for the Electrum side of things. Here, we address this
oversight.
2024-01-09 09:37:14 +01:00
benthecarman
f836794e98
Don't call system time in unless feature enabled 2023-12-19 13:22:17 -06:00
Matt Corallo
c6e4debee9 Bump versions to 0.0.119/lightning-invoice 0.27 2023-12-15 23:53:40 +00: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
f368facac0
Manually download bitcoind/electrs for CI tests
Previously, we used the auto-download feature of the
`electrsd`/`bitcoind` crates. While convenient, they unnecessarily
introduced a lot of dependecies (`zip`, `zstd`, `time`, etc.) to our
test environment which needed pinning for the MSRV of 1.63.

Here, we introduce a new `no_download` config flag to the
`lightning-transaction-sync` crate allowing us to disable this
auto-download feature in CI, where we now opt to download the
corresponding binaries manually. We keep the default-auto-download as a
convenience feature for running tests locally though.
2023-12-08 14:40:15 +01: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
Elias Rohrer
31ea90eba2
Use esplora-client's async-https-rustls feature
Now that we upgraded `esplora-client` to 0.6 we can use
`async-https-rustls` instead of manually overriding the `reqwest`
dependency.
2023-11-24 12:48:22 +01:00
Elias Rohrer
c2e81fbb82
DRY up Esplora/Electrum integration_tests 2023-11-23 09:30:58 +01:00
Elias Rohrer
28c14cd884
Add Electrum integration test 2023-11-23 09:30:58 +01:00
Elias Rohrer
4dd5ccbe49
Implement ElectrumSyncClient 2023-11-23 09:30:57 +01:00
Elias Rohrer
d2ecf0766c
Set pending_sync when last-minute check fails in Esplora 2023-11-23 09:30:57 +01:00
Elias Rohrer
82f4c10e18
Move sync_ methods to SyncState 2023-11-23 09:30:57 +01:00
Elias Rohrer
e14e2c3fba
Improve EsploraSyncClient test coverage
In particular, we now test `register_output` functionality, too.
2023-11-23 09:30:57 +01:00
Elias Rohrer
48c46bf772
Improve EsploraSyncClient logging
We give some more information while reducing the log levels to make the
logging less spammy.

We also convert one safe-to-unwrap case from returning an error to
unwrapping the value.
2023-11-23 09:30:57 +01:00
Elias Rohrer
5b7c1d511b
Use upstream TestLogger util in tx sync tests 2023-11-23 09:30:57 +01:00
Elias Rohrer
c8ff32197a
Return confirmation height via Confirm::get_relevant_txids
We previously included the block hash, but it's also useful to include
the height under which we expect the respective transaction to be
confirmed.
2023-11-23 09:30:56 +01: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
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