]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix lightning-block-sync warnings.
authorArik Sosman <git@arik.io>
Wed, 14 Aug 2024 20:31:40 +0000 (13:31 -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-block-sync/src/gossip.rs
lightning-block-sync/src/poll.rs
lightning-block-sync/src/test_utils.rs

index feb130fe7b4c4ccf439c8b4bd52fb23dc1dc0c30..f075cf7b25747c6fb8ad3a11635925b3100b2121 100644 (file)
@@ -198,7 +198,7 @@ where
                                                return Err(UtxoLookupError::UnknownTx);
                                        }
 
-                                       outpoint = OutPoint::new(transaction.txid(), output_index.into());
+                                       outpoint = OutPoint::new(transaction.compute_txid(), output_index.into());
                                        output = transaction.output[output_index as usize].clone();
                                }};
                        }
index 3940b71f7607b138e836efeaef17e779c3e4cbd1..843cc96189984ef231cc37edf4b66668dbe36c5b 100644 (file)
@@ -144,8 +144,8 @@ impl ValidatedBlockHeader {
                        if self.height % 2016 == 0 {
                                let target = self.header.target();
                                let previous_target = previous_header.header.target();
-                               let min_target = previous_target.min_difficulty_transition_threshold();
-                               let max_target = previous_target.max_difficulty_transition_threshold();
+                               let min_target = previous_target.min_transition_threshold();
+                               let max_target = previous_target.max_transition_threshold_unchecked();
                                if target > max_target || target < min_target {
                                        return Err(BlockSourceError::persistent("invalid difficulty transition"));
                                }
index bf507a14dc6f0c291e061b1b9f37b0f8fc1aa936..098f1a8769a4f38f7ffe8aa787cf4203c0782e9e 100644 (file)
@@ -53,7 +53,7 @@ impl Blockchain {
                                input: vec![],
                                output: vec![],
                        };
-                       let merkle_root = TxMerkleNode::from_raw_hash(coinbase.txid().to_raw_hash());
+                       let merkle_root = TxMerkleNode::from_raw_hash(coinbase.compute_txid().to_raw_hash());
                        self.blocks.push(Block {
                                header: Header {
                                        version: Version::NO_SOFT_FORK_SIGNALLING,