Skip to content

Commit e4e1ec3

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 ea335f4 commit e4e1ec3

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
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
@@ -432,7 +432,7 @@ where
432432
fn get_confirmed_tx(
433433
&self, tx: &Transaction, prob_conf_height: u32,
434434
) -> Result<ConfirmedTx, InternalError> {
435-
let txid = tx.txid();
435+
let txid = tx.compute_txid();
436436
match self.client.transaction_get_merkle(&txid, prob_conf_height as usize) {
437437
Ok(merkle_res) => {
438438
debug_assert_eq!(prob_conf_height, merkle_res.block_height as u32);

lightning-transaction-sync/src/esplora.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ where
367367
// unwrap() safety: len() > 0 is checked above
368368
let pos = *indexes.first().unwrap() as usize;
369369
if let Some(tx) = maybe_await!(self.client.get_tx(&txid))? {
370-
if tx.txid() != txid {
370+
if tx.compute_txid() != txid {
371371
log_error!(self.logger, "Retrieved transaction for txid {} doesn't match expectations. This should not happen. Please verify server integrity.", txid);
372372
return Err(InternalError::Failed);
373373
}

lightning-transaction-sync/tests/integration_tests.rs

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

0 commit comments

Comments
 (0)