Skip to content

Commit 54eda85

Browse files
committed
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.
1 parent ad3193c commit 54eda85

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lightning-transaction-sync/src/common.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@ impl SyncState {
7474
);
7575
}
7676

77-
self.watched_transactions.remove(&ctx.tx.txid());
77+
self.watched_transactions.remove(&ctx.tx.compute_txid());
7878

7979
for input in &ctx.tx.input {
8080
if let Some(output) = self.watched_outputs.remove(&input.previous_output) {
81-
let spent = (ctx.tx.txid(), ctx.block_height, input.previous_output, output);
81+
let spent =
82+
(ctx.tx.compute_txid(), ctx.block_height, input.previous_output, output);
8283
self.outputs_spends_pending_threshold_conf.push(spent);
8384
}
8485
}

lightning-transaction-sync/src/electrum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ where
454454
fn get_confirmed_tx(
455455
&self, tx: &Transaction, prob_conf_height: u32,
456456
) -> Result<ConfirmedTx, InternalError> {
457-
let txid = tx.txid();
457+
let txid = tx.compute_txid();
458458
match self.client.transaction_get_merkle(
459459
&util::bitcoin_to_esplora_txid(&txid),
460460
prob_conf_height as usize,

lightning-transaction-sync/tests/integration_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl TestConfirmable {
136136
impl Confirm for TestConfirmable {
137137
fn transactions_confirmed(&self, header: &Header, txdata: &TransactionData<'_>, height: u32) {
138138
for (_, tx) in txdata {
139-
let txid = tx.txid();
139+
let txid = tx.compute_txid();
140140
let block_hash = header.block_hash();
141141
self.confirmed_txs.lock().unwrap().insert(txid, (block_hash, height));
142142
self.unconfirmed_txs.lock().unwrap().remove(&txid);

0 commit comments

Comments
 (0)