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
KeysInterface::get_shutdown_pubkey is used to form P2WPKH shutdown
scripts. However, BOLT 2 allows for a wider variety of scripts. Refactor
KeysInterface to allow any supported script while still maintaining
serialization backwards compatibility with P2WPKH script pubkeys stored
simply as the PublicKey.
Add an optional TLV field to Channel and ChannelMonitor to support the
new format, but continue to serialize the legacy PublicKey format.
use ln::chan_utils::{HTLCOutputInCommitment,ChannelPublicKeys,ChannelTransactionParameters,HolderCommitmentTransaction,CounterpartyChannelTransactionParameters};
2851
+
use ln::script::ShutdownScript;
2843
2852
use util::test_utils::{TestLogger,TestBroadcaster,TestFeeEstimator};
2844
2853
use bitcoin::secp256k1::key::{SecretKey,PublicKey};
2845
2854
use bitcoin::secp256k1::Secp256k1;
@@ -2933,9 +2942,10 @@ mod tests {
2933
2942
};
2934
2943
// Prune with one old state and a holder commitment tx holding a few overlaps with the
2935
2944
// old state.
2945
+
let shutdown_pubkey = PublicKey::from_secret_key(&secp_ctx,&SecretKey::from_slice(&[42;32]).unwrap());
2936
2946
let best_block = BestBlock::from_genesis(Network::Testnet);
2937
2947
let monitor = ChannelMonitor::new(Secp256k1::new(), keys,
Copy file name to clipboardExpand all lines: lightning/src/chain/keysinterface.rs
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,7 @@ use chain::transaction::OutPoint;
36
36
use ln::chan_utils;
37
37
use ln::chan_utils::{HTLCOutputInCommitment, make_funding_redeemscript,ChannelPublicKeys,HolderCommitmentTransaction,ChannelTransactionParameters,CommitmentTransaction};
let funding_redeemscript = self.get_funding_redeemscript();
1677
1676
let funding_txo_script = funding_redeemscript.to_v0_p2wsh();
1678
1677
let obscure_factor = get_commitment_transaction_number_obscure_factor(&self.get_holder_pubkeys().payment_point,&self.get_counterparty_pubkeys().payment_point,self.is_outbound());
1678
+
let shutdown_script = self.shutdown_scriptpubkey.clone().map(|script| script.into_inner());
1679
1679
let channel_monitor = ChannelMonitor::new(self.secp_ctx.clone(),self.holder_signer.clone(),
let funding_txo = self.get_funding_txo().unwrap();
1750
1750
let funding_txo_script = funding_redeemscript.to_v0_p2wsh();
1751
1751
let obscure_factor = get_commitment_transaction_number_obscure_factor(&self.get_holder_pubkeys().payment_point,&self.get_counterparty_pubkeys().payment_point,self.is_outbound());
1752
+
let shutdown_script = self.shutdown_scriptpubkey.clone().map(|script| script.into_inner());
1752
1753
let channel_monitor = ChannelMonitor::new(self.secp_ctx.clone(),self.holder_signer.clone(),
use ln::msgs::{ChannelUpdate,DataLossProtect,DecodeError,OptionalField,UnsignedChannelUpdate};
5085
+
use ln::script::ShutdownScript;
5072
5086
use ln::chan_utils;
5073
5087
use ln::chan_utils::{ChannelPublicKeys,HolderCommitmentTransaction,CounterpartyChannelTransactionParameters,HTLC_SUCCESS_TX_WEIGHT,HTLC_TIMEOUT_TX_WEIGHT};
0 commit comments