From: Arik Sosman Date: Wed, 14 Aug 2024 20:31:40 +0000 (-0700) Subject: Fix lightning-block-sync warnings. X-Git-Tag: v0.0.124-beta~9^2~2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=92aac2a2aec44eadcb2a41ea658ae49a6c010834;p=rust-lightning 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. --- diff --git a/lightning-block-sync/src/gossip.rs b/lightning-block-sync/src/gossip.rs index feb130fe7..f075cf7b2 100644 --- a/lightning-block-sync/src/gossip.rs +++ b/lightning-block-sync/src/gossip.rs @@ -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(); }}; } diff --git a/lightning-block-sync/src/poll.rs b/lightning-block-sync/src/poll.rs index 3940b71f7..843cc9618 100644 --- a/lightning-block-sync/src/poll.rs +++ b/lightning-block-sync/src/poll.rs @@ -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")); } diff --git a/lightning-block-sync/src/test_utils.rs b/lightning-block-sync/src/test_utils.rs index bf507a14d..098f1a876 100644 --- a/lightning-block-sync/src/test_utils.rs +++ b/lightning-block-sync/src/test_utils.rs @@ -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,