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
Make commitment transaction signing a part of ChannelKeys.
This adds a new fn to ChannelKeys which is called when we generte
a new remote commitment transaction for signing. While it may be
theoretically possible to unwind state updates by disconnecting and
reconnecting as well as making appropriate state machine changes,
the effort required to get it correct likely outweighs the UX cost
of "preflighting" the requests to hardwre wallets.
let commitment_sighash = hash_to_message!(&bip143::SighashComponents::new(&commitment_tx).sighash_all(&commitment_tx.input[0],&channel_funding_script, channel_value_satoshis)[..]);
157
+
let commitment_sig = secp_ctx.sign(&commitment_sighash,&self.funding_key);
let remote_keys = self.build_remote_transaction_keys()?;
3532
3530
let remote_commitment_tx = self.build_commitment_transaction(self.cur_remote_commitment_transaction_number,&remote_keys,false,true, feerate_per_kw);
3533
-
let remote_commitment_txid = remote_commitment_tx.0.txid();
3534
-
let remote_sighash = hash_to_message!(&bip143::SighashComponents::new(&remote_commitment_tx.0).sighash_all(&remote_commitment_tx.0.input[0],&funding_script,self.channel_value_satoshis)[..]);
3535
-
let our_sig = self.secp_ctx.sign(&remote_sighash,self.local_keys.funding_key());
3536
-
log_trace!(self,"Signing remote commitment tx {} with redeemscript {} with pubkey {} -> {}", encode::serialize_hex(&remote_commitment_tx.0), encode::serialize_hex(&funding_script), log_bytes!(PublicKey::from_secret_key(&self.secp_ctx,self.local_keys.funding_key()).serialize()), log_bytes!(our_sig.serialize_compact()[..]));
let res = self.local_keys.sign_remote_commitment(self.channel_value_satoshis,&self.get_funding_redeemscript(), feerate_per_kw,&remote_commitment_tx.0,&remote_keys,&htlcs,self.our_to_self_delay,&self.secp_ctx)
3540
+
.map_err(|_| ChannelError::Close("Failed to get signatures for new commitment_signed"))?;
3541
+
signature = res.0;
3542
+
htlc_signatures = res.1;
3543
+
3544
+
log_trace!(self,"Signed remote commitment tx {} with redeemscript {} -> {}",
0 commit comments