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
panic!("Tried to sign commitment transaction that had input count != 1!");
648
646
}
649
-
if tx.witness.len() != 1 || tx.witness[0].len() != 0{
647
+
if tx.input[0].witness.len() != 0{
650
648
panic!("Tried to re-sign commitment transaction");
651
649
}
652
650
653
651
let funding_redeemscript = self.get_funding_redeemscript();
654
652
655
-
let sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&tx).sighash_all(&tx,0,&funding_redeemscript,self.channel_value_satoshis)[..]));
653
+
let sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&tx).sighash_all(&tx.input[0],&funding_redeemscript,self.channel_value_satoshis)[..]));
656
654
let our_sig = secp_call!(self.secp_ctx.sign(&sighash,&self.local_keys.funding_key));
657
655
658
-
tx.witness[0].push(Vec::new());// First is the multisig dummy
656
+
tx.input[0].witness.push(Vec::new());// First is the multisig dummy
659
657
660
658
let our_funding_key = PublicKey::from_secret_key(&self.secp_ctx,&self.local_keys.funding_key).unwrap().serialize();
661
659
let their_funding_key = self.their_funding_pubkey.serialize();
let remote_keys = self.build_remote_transaction_keys()?;
882
877
let remote_initial_commitment_tx = self.build_commitment_transaction(self.cur_remote_commitment_transaction_number,&remote_keys,false,false)?.0;
883
-
let remote_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&remote_initial_commitment_tx).sighash_all(&remote_initial_commitment_tx,0,&funding_script,self.channel_value_satoshis)[..]));
878
+
let remote_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&remote_initial_commitment_tx).sighash_all(&remote_initial_commitment_tx.input[0],&funding_script,self.channel_value_satoshis)[..]));
884
879
885
880
let local_keys = self.build_local_transaction_keys(self.cur_local_commitment_transaction_number)?;
886
881
let local_initial_commitment_tx = self.build_commitment_transaction(self.cur_local_commitment_transaction_number,&local_keys,true,false)?.0;
887
-
let local_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&local_initial_commitment_tx).sighash_all(&local_initial_commitment_tx,0,&funding_script,self.channel_value_satoshis)[..]));
882
+
let local_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&local_initial_commitment_tx).sighash_all(&local_initial_commitment_tx.input[0],&funding_script,self.channel_value_satoshis)[..]));
888
883
889
884
// They sign the "local" commitment transaction, allowing us to broadcast the tx if we wish.
let local_keys = self.build_local_transaction_keys(self.cur_local_commitment_transaction_number)?;
948
943
let local_initial_commitment_tx = self.build_commitment_transaction(self.cur_local_commitment_transaction_number,&local_keys,true,false)?.0;
949
-
let local_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&local_initial_commitment_tx).sighash_all(&local_initial_commitment_tx,0,&funding_script,self.channel_value_satoshis)[..]));
944
+
let local_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&local_initial_commitment_tx).sighash_all(&local_initial_commitment_tx.input[0],&funding_script,self.channel_value_satoshis)[..]));
950
945
951
946
// They sign the "local" commitment transaction, allowing us to broadcast the tx if we wish.
let local_keys = self.build_local_transaction_keys(self.cur_local_commitment_transaction_number)?;
1169
1164
let local_commitment_tx = self.build_commitment_transaction(self.cur_local_commitment_transaction_number,&local_keys,true,false)?;
1170
-
let local_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&local_commitment_tx.0).sighash_all(&local_commitment_tx.0,0,&funding_script,self.channel_value_satoshis)[..]));
1165
+
let local_commitment_txid = local_commitment_tx.0.txid();
1166
+
let local_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&local_commitment_tx.0).sighash_all(&local_commitment_tx.0.input[0],&funding_script,self.channel_value_satoshis)[..]));
let remote_keys = self.build_remote_transaction_keys()?;
1466
1462
let remote_initial_commitment_tx = self.build_commitment_transaction(self.cur_remote_commitment_transaction_number,&remote_keys,false,false)?.0;
1467
-
let remote_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&remote_initial_commitment_tx).sighash_all(&remote_initial_commitment_tx,0,&funding_script,self.channel_value_satoshis)[..]));
1463
+
let remote_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&remote_initial_commitment_tx).sighash_all(&remote_initial_commitment_tx.input[0],&funding_script,self.channel_value_satoshis)[..]));
1468
1464
1469
1465
// We sign the "remote" commitment transaction, allowing them to broadcast the tx if they wish.
let remote_keys = self.build_remote_transaction_keys()?;
1641
1637
let remote_commitment_tx = self.build_commitment_transaction(self.cur_remote_commitment_transaction_number,&remote_keys,false,true)?;
1642
-
let remote_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&remote_commitment_tx.0).sighash_all(&remote_commitment_tx.0,0,&funding_script,self.channel_value_satoshis)[..]));
1638
+
let remote_commitment_txid = remote_commitment_tx.0.txid();
1639
+
let remote_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&remote_commitment_tx.0).sighash_all(&remote_commitment_tx.0.input[0],&funding_script,self.channel_value_satoshis)[..]));
1643
1640
let our_sig = secp_call!(self.secp_ctx.sign(&remote_sighash,&self.local_keys.funding_key));
1644
1641
1645
1642
letmut htlc_sigs = Vec::new();
1646
1643
1647
1644
forref htlc in remote_commitment_tx.1.iter(){
1648
-
let htlc_tx = self.build_htlc_transaction(&remote_commitment_tx.0.txid(), htlc,false,&remote_keys)?;
1645
+
let htlc_tx = self.build_htlc_transaction(&remote_commitment_txid, htlc,false,&remote_keys)?;
1649
1646
let htlc_redeemscript = chan_utils::get_htlc_redeemscript(&htlc,&remote_keys, htlc.offered);
1650
-
let htlc_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&htlc_tx).sighash_all(&htlc_tx,0,&htlc_redeemscript, htlc.amount_msat / 1000)[..]));
1647
+
let htlc_sighash = secp_call!(Message::from_slice(&bip143::SighashComponents::new(&htlc_tx).sighash_all(&htlc_tx.input[0],&htlc_redeemscript, htlc.amount_msat / 1000)[..]));
1651
1648
let our_htlc_key = secp_call!(chan_utils::derive_private_key(&self.secp_ctx,&remote_keys.per_commitment_point,&self.local_keys.htlc_base_key));
let their_signature = Signature::from_der(&secp_ctx,&hex_bytes($their_sig_hex).unwrap()[..]).unwrap();
1752
-
let sighash = Message::from_slice(&bip143::SighashComponents::new(&unsigned_tx.0).sighash_all(&unsigned_tx.0,0,&chan.get_funding_redeemscript(), chan.channel_value_satoshis)[..]).unwrap();
1749
+
let sighash = Message::from_slice(&bip143::SighashComponents::new(&unsigned_tx.0).sighash_all(&unsigned_tx.0.input[0],&chan.get_funding_redeemscript(), chan.channel_value_satoshis)[..]).unwrap();
0 commit comments