]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix lightning-transaction sync warnings.
authorArik Sosman <git@arik.io>
Thu, 15 Aug 2024 02:52:01 +0000 (19:52 -0700)
committerArik Sosman <git@arik.io>
Fri, 16 Aug 2024 17:31:45 +0000 (10:31 -0700)
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.

lightning-transaction-sync/src/common.rs
lightning-transaction-sync/src/electrum.rs
lightning-transaction-sync/src/esplora.rs
lightning-transaction-sync/tests/integration_tests.rs

index 420d7d8a9575f8672ce3111a52d000270c141a4e..1d6e64bab00bef40636c175dbd925dfb7920ea73 100644 (file)
@@ -74,11 +74,12 @@ impl SyncState {
                                );
                        }
 
-                       self.watched_transactions.remove(&ctx.tx.txid());
+                       self.watched_transactions.remove(&ctx.tx.compute_txid());
 
                        for input in &ctx.tx.input {
                                if let Some(output) = self.watched_outputs.remove(&input.previous_output) {
-                                       let spent = (ctx.tx.txid(), ctx.block_height, input.previous_output, output);
+                                       let spent =
+                                               (ctx.tx.compute_txid(), ctx.block_height, input.previous_output, output);
                                        self.outputs_spends_pending_threshold_conf.push(spent);
                                }
                        }
index ddd74743ff3eae371f5227498a44734b0a0716ac..015cb42c6391c58d9524aaa392ee964711b0ccf6 100644 (file)
@@ -432,7 +432,7 @@ where
        fn get_confirmed_tx(
                &self, tx: &Transaction, prob_conf_height: u32,
        ) -> Result<ConfirmedTx, InternalError> {
-               let txid = tx.txid();
+               let txid = tx.compute_txid();
                match self.client.transaction_get_merkle(&txid, prob_conf_height as usize) {
                        Ok(merkle_res) => {
                                debug_assert_eq!(prob_conf_height, merkle_res.block_height as u32);
index b3e9285ec734986bdf7b1bb8fe0b4a4de22023e8..564d7f1773ade4e69e6aa3bdf4420d2758f33045 100644 (file)
@@ -367,7 +367,7 @@ where
                        // unwrap() safety: len() > 0 is checked above
                        let pos = *indexes.first().unwrap() as usize;
                        if let Some(tx) = maybe_await!(self.client.get_tx(&txid))? {
-                               if tx.txid() != txid {
+                               if tx.compute_txid() != txid {
                                        log_error!(self.logger, "Retrieved transaction for txid {} doesn't match expectations. This should not happen. Please verify server integrity.", txid);
                                        return Err(InternalError::Failed);
                                }
index 2cf913b5667fdfb784b9e61ab7ead0a2b0e8a949..c887b2be0bf18a1e9a7494da3d568f2ddbcfdb3e 100644 (file)
@@ -134,7 +134,7 @@ impl TestConfirmable {
 impl Confirm for TestConfirmable {
        fn transactions_confirmed(&self, header: &Header, txdata: &TransactionData<'_>, height: u32) {
                for (_, tx) in txdata {
-                       let txid = tx.txid();
+                       let txid = tx.compute_txid();
                        let block_hash = header.block_hash();
                        self.confirmed_txs.lock().unwrap().insert(txid, (block_hash, height));
                        self.unconfirmed_txs.lock().unwrap().remove(&txid);