You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lightning/src/ln/channel.rs
+17-27Lines changed: 17 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -1830,7 +1830,7 @@ trait InitialRemoteCommitmentReceiver<SP: Deref> where SP::Target: SignerProvide
1830
1830
context.counterparty_funding_pubkey()
1831
1831
);
1832
1832
1833
-
if context.holder_signer.as_ref().validate_holder_commitment(&holder_commitment_tx, Vec::new()).is_err() {
1833
+
if context.holder_signer.as_ref().validate_holder_commitment(&holder_commitment_tx, Vec::new(), &context.secp_ctx).is_err() {
1834
1834
return Err(ChannelError::close("Failed to validate our commitment".to_owned()));
1835
1835
}
1836
1836
@@ -5245,23 +5245,28 @@ impl<SP: Deref> FundedChannel<SP> where
5245
5245
return Err(ChannelError::close("Peer sent commitment_signed after we'd started exchanging closing_signeds".to_owned()));
5246
5246
}
5247
5247
5248
-
let funding_script = self.context.get_funding_redeemscript();
5249
-
5250
5248
let keys = self.context.build_holder_transaction_keys(self.holder_commitment_point.current_point());
5251
5249
5252
5250
let commitment_stats = self.context.build_commitment_transaction(self.holder_commitment_point.transaction_number(), &keys, true, false, logger);
5251
+
5252
+
if msg.htlc_signatures.len() != commitment_stats.num_nondust_htlcs {
5253
+
return Err(ChannelError::close(format!("Got wrong number of HTLC signatures ({}) from remote. It must be {}", msg.htlc_signatures.len(), commitment_stats.num_nondust_htlcs)));
5254
+
}
5255
+
5256
+
let holder_commitment_tx = HolderCommitmentTransaction::new(
if let Err(_) = self.context.secp_ctx.verify_ecdsa(&sighash, &msg.signature, &self.context.counterparty_funding_pubkey()) {
5263
-
return Err(ChannelError::close("Invalid commitment tx signature from peer".to_owned()));
5264
-
}
5265
5270
bitcoin_tx.txid
5266
5271
};
5267
5272
let mut htlcs_cloned: Vec<_> = commitment_stats.htlcs_included.iter().map(|htlc| (htlc.0.clone(), htlc.1.map(|h| h.clone()))).collect();
@@ -5296,10 +5301,6 @@ impl<SP: Deref> FundedChannel<SP> where
5296
5301
}
5297
5302
}
5298
5303
5299
-
if msg.htlc_signatures.len() != commitment_stats.num_nondust_htlcs {
5300
-
return Err(ChannelError::close(format!("Got wrong number of HTLC signatures ({}) from remote. It must be {}", msg.htlc_signatures.len(), commitment_stats.num_nondust_htlcs)));
5301
-
}
5302
-
5303
5304
// Up to LDK 0.0.115, HTLC information was required to be duplicated in the
5304
5305
// `htlcs_and_sigs` vec and in the `holder_commitment_tx` itself, both of which were passed
5305
5306
// in the `ChannelMonitorUpdate`. In 0.0.115, support for having a separate set of
@@ -5346,17 +5347,6 @@ impl<SP: Deref> FundedChannel<SP> where
5346
5347
debug_assert!(source_opt.is_none(), "HTLCSource should have been put somewhere");
5347
5348
}
5348
5349
5349
-
let holder_commitment_tx = HolderCommitmentTransaction::new(
assert!(idx == state.last_holder_commitment || idx == state.last_holder_commitment - 1,"expecting to validate the current or next holder commitment - trying {}, current {}", idx, state.last_holder_commitment);
0 commit comments