Skip to content

Commit 4b6cc0b

Browse files
committed
fixup! don't sign HTLC txs together with holder commitment tx, yet
1 parent 2552fd5 commit 4b6cc0b

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

lightning/src/chain/keysinterface.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ pub trait ChannelKeys : Send+Clone {
239239
/// An external signer implementation should check that the commitment has not been revoked.
240240
//
241241
// TODO: Document the things someone using this interface should enforce before signing.
242-
fn sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()>;
242+
fn sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()>;
243243

244244
/// Same as sign_holder_commitment, but exists only for tests to get access to holder commitment
245245
/// transactions which will be broadcasted later, after the channel has moved on to a newer
@@ -481,12 +481,11 @@ impl ChannelKeys for InMemoryChannelKeys {
481481
Ok((commitment_sig, htlc_sigs))
482482
}
483483

484-
fn sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()> {
484+
fn sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
485485
let funding_pubkey = PublicKey::from_secret_key(secp_ctx, &self.funding_key);
486486
let funding_redeemscript = make_funding_redeemscript(&funding_pubkey, &self.counterparty_pubkeys().funding_pubkey);
487487
let sig = commitment_tx.trust().built_transaction().sign(&self.funding_key, &funding_redeemscript, self.channel_value_satoshis, secp_ctx);
488-
let htlc_sigs = self.sign_holder_commitment_htlc_transactions(&commitment_tx, secp_ctx)?;
489-
Ok((sig, htlc_sigs))
488+
Ok(sig)
490489
}
491490

492491
#[cfg(any(test,feature = "unsafe_revoked_tx_signing"))]

lightning/src/ln/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4743,7 +4743,7 @@ mod tests {
47434743
&chan.holder_keys.pubkeys().funding_pubkey,
47444744
chan.counterparty_funding_pubkey()
47454745
);
4746-
let holder_sig = chan_keys.sign_holder_commitment(&holder_commitment_tx, &secp_ctx).unwrap().0;
4746+
let holder_sig = chan_keys.sign_holder_commitment(&holder_commitment_tx, &secp_ctx).unwrap();
47474747
assert_eq!(Signature::from_der(&hex::decode($sig_hex).unwrap()[..]).unwrap(), holder_sig, "holder_sig");
47484748

47494749
let funding_redeemscript = chan.get_funding_redeemscript();

lightning/src/ln/onchaintx.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ impl<ChanSigner: ChannelKeys> OnchainTxHandler<ChanSigner> {
926926
pub(crate) fn get_fully_signed_holder_tx(&mut self, funding_redeemscript: &Script) -> Option<Transaction> {
927927
if let Some(ref mut holder_commitment) = self.holder_commitment {
928928
match self.key_storage.sign_holder_commitment(&holder_commitment, &self.secp_ctx) {
929-
Ok((sig, _htlc_sigs)) => {
929+
Ok(sig) => {
930930
Some(holder_commitment.add_holder_sig(funding_redeemscript, sig))
931931
},
932932
Err(_) => return None,
@@ -940,7 +940,7 @@ impl<ChanSigner: ChannelKeys> OnchainTxHandler<ChanSigner> {
940940
pub(crate) fn get_fully_signed_copy_holder_tx(&mut self, funding_redeemscript: &Script) -> Option<Transaction> {
941941
if let Some(ref mut holder_commitment) = self.holder_commitment {
942942
match self.key_storage.sign_holder_commitment(holder_commitment, &self.secp_ctx) {
943-
Ok((sig, _htlc_sigs)) => {
943+
Ok(sig) => {
944944
Some(holder_commitment.add_holder_sig(funding_redeemscript, sig))
945945
},
946946
Err(_) => return None,

lightning/src/util/enforcing_trait_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl ChannelKeys for EnforcingChannelKeys {
7272
Ok(self.inner.sign_counterparty_commitment(commitment_tx, secp_ctx).unwrap())
7373
}
7474

75-
fn sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()> {
75+
fn sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
7676
self.verify_holder_commitment_tx(commitment_tx, secp_ctx);
7777

7878
// TODO: enforce the ChannelKeys contract - error if this commitment was already revoked

0 commit comments

Comments
 (0)