Skip to content

Commit 6790187

Browse files
committed
Make txid check first check in tx_signatures handling
1 parent 9363bcc commit 6790187

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lightning/src/ln/channel.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -5701,6 +5701,14 @@ impl<SP: Deref> Channel<SP> where
57015701
}
57025702

57035703
if let Some(ref mut signing_session) = self.interactive_tx_signing_session {
5704+
if msg.tx_hash != signing_session.unsigned_tx.compute_txid() {
5705+
return Err(ChannelError::Close(
5706+
(
5707+
"The txid for the transaction does not match".to_string(),
5708+
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
5709+
)));
5710+
}
5711+
57045712
if msg.witnesses.len() != signing_session.remote_inputs_count() {
57055713
return Err(ChannelError::Warn(
57065714
"Witness count did not match contributed input count".to_string()
@@ -5722,14 +5730,6 @@ impl<SP: Deref> Channel<SP> where
57225730
// for spending. Doesn't seem to be anything in rust-bitcoin.
57235731
}
57245732

5725-
if msg.tx_hash != signing_session.unsigned_tx.compute_txid() {
5726-
return Err(ChannelError::Close(
5727-
(
5728-
"The txid for the transaction does not match".to_string(),
5729-
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
5730-
)));
5731-
}
5732-
57335733
let (tx_signatures_opt, funding_tx_opt) = signing_session.received_tx_signatures(msg.clone())
57345734
.map_err(|_| ChannelError::Warn("Witness count did not match contributed input count".to_string()))?;
57355735
if funding_tx_opt.is_some() {

0 commit comments

Comments
 (0)