@@ -39,7 +39,7 @@ use bitcoin::secp256k1;
39
39
40
40
use ln:: msgs:: DecodeError ;
41
41
use ln:: chan_utils;
42
- use ln:: chan_utils:: { CounterpartyCommitmentSecrets , HTLCOutputInCommitment , HTLCType , ChannelStaticInfo , HolderCommitmentTransactionInfo } ;
42
+ use ln:: chan_utils:: { CounterpartyCommitmentSecrets , HTLCOutputInCommitment , HTLCType , ChannelTransactionParameters , HolderCommitmentTransaction } ;
43
43
use ln:: channelmanager:: { HTLCSource , PaymentPreimage , PaymentHash } ;
44
44
use ln:: onchaintx:: { OnchainTxHandler , InputDescriptors } ;
45
45
use chain:: chaininterface:: { BroadcasterInterface , FeeEstimator } ;
@@ -474,7 +474,7 @@ const MIN_SERIALIZATION_VERSION: u8 = 1;
474
474
#[ derive( Clone ) ]
475
475
pub ( crate ) enum ChannelMonitorUpdateStep {
476
476
LatestHolderCommitmentTXInfo {
477
- commitment_info : HolderCommitmentTransactionInfo ,
477
+ commitment_info : HolderCommitmentTransaction ,
478
478
htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Signature > , Option < HTLCSource > ) > ,
479
479
} ,
480
480
LatestCounterpartyCommitmentTXInfo {
@@ -936,27 +936,27 @@ impl<ChanSigner: ChannelKeys + Writeable> ChannelMonitor<ChanSigner> {
936
936
impl < ChanSigner : ChannelKeys > ChannelMonitor < ChanSigner > {
937
937
pub ( crate ) fn new ( keys : ChanSigner , shutdown_pubkey : & PublicKey ,
938
938
on_counterparty_tx_csv : u16 , destination_script : & Script , funding_info : ( OutPoint , Script ) ,
939
- channel_static_info : & ChannelStaticInfo ,
939
+ channel_parameters : & ChannelTransactionParameters ,
940
940
funding_redeemscript : Script , channel_value_satoshis : u64 ,
941
941
commitment_transaction_number_obscure_factor : u64 ,
942
- initial_holder_commitment_info : HolderCommitmentTransactionInfo ) -> ChannelMonitor < ChanSigner > {
942
+ initial_holder_commitment_info : HolderCommitmentTransaction ) -> ChannelMonitor < ChanSigner > {
943
943
944
944
assert ! ( commitment_transaction_number_obscure_factor <= ( 1 << 48 ) ) ;
945
945
let our_channel_close_key_hash = WPubkeyHash :: hash ( & shutdown_pubkey. serialize ( ) ) ;
946
946
let shutdown_script = Builder :: new ( ) . push_opcode ( opcodes:: all:: OP_PUSHBYTES_0 ) . push_slice ( & our_channel_close_key_hash[ ..] ) . into_script ( ) ;
947
947
let payment_key_hash = WPubkeyHash :: hash ( & keys. pubkeys ( ) . payment_point . serialize ( ) ) ;
948
948
let counterparty_payment_script = Builder :: new ( ) . push_opcode ( opcodes:: all:: OP_PUSHBYTES_0 ) . push_slice ( & payment_key_hash[ ..] ) . into_script ( ) ;
949
949
950
- let counterparty_delayed_payment_base_key = channel_static_info . counterparty_pubkeys . delayed_payment_basepoint ;
951
- let counterparty_htlc_base_key = channel_static_info . counterparty_pubkeys . htlc_basepoint ;
950
+ let counterparty_delayed_payment_base_key = channel_parameters . counterparty_pubkeys . delayed_payment_basepoint ;
951
+ let counterparty_htlc_base_key = channel_parameters . counterparty_pubkeys . htlc_basepoint ;
952
952
let counterparty_tx_cache = CounterpartyCommitmentTransaction { counterparty_delayed_payment_base_key, counterparty_htlc_base_key, on_counterparty_tx_csv, per_htlc : HashMap :: new ( ) } ;
953
953
954
- let mut onchain_tx_handler = OnchainTxHandler :: new ( destination_script. clone ( ) , keys. clone ( ) , channel_static_info . clone ( ) ) ;
954
+ let mut onchain_tx_handler = OnchainTxHandler :: new ( destination_script. clone ( ) , keys. clone ( ) , channel_parameters . clone ( ) ) ;
955
955
956
956
let secp_ctx = Secp256k1 :: new ( ) ;
957
957
958
- let directed_channel_static_info = channel_static_info . to_directed ( true ) ;
959
- let txid = initial_holder_commitment_info. txid ( & directed_channel_static_info , & secp_ctx) ;
958
+ let directed_channel_parameters = channel_parameters . to_directed ( true ) ;
959
+ let txid = initial_holder_commitment_info. txid ( & directed_channel_parameters , & secp_ctx) ;
960
960
961
961
// block for Rust 1.34 compat
962
962
let ( holder_commitment_tx, current_holder_commitment_number) = {
@@ -983,7 +983,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
983
983
ChannelMonitor {
984
984
latest_update_id : 0 ,
985
985
commitment_transaction_number_obscure_factor,
986
- is_outbound : channel_static_info . is_outbound_from_holder ,
986
+ is_outbound : channel_parameters . is_outbound_from_holder ,
987
987
988
988
destination_script : destination_script. clone ( ) ,
989
989
broadcasted_holder_revokable_script : None ,
@@ -1000,7 +1000,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1000
1000
channel_value_satoshis,
1001
1001
their_cur_revocation_points : None ,
1002
1002
1003
- on_holder_tx_csv : channel_static_info . counterparty_selected_contest_delay ,
1003
+ on_holder_tx_csv : channel_parameters . counterparty_selected_contest_delay ,
1004
1004
1005
1005
commitment_secrets : CounterpartyCommitmentSecrets :: new ( ) ,
1006
1006
counterparty_claimable_outpoints : HashMap :: new ( ) ,
@@ -1133,8 +1133,8 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1133
1133
/// is important that any clones of this channel monitor (including remote clones) by kept
1134
1134
/// up-to-date as our holder commitment transaction is updated.
1135
1135
/// Panics if set_on_holder_tx_csv has never been called.
1136
- fn provide_latest_holder_commitment_tx_info ( & mut self , commitment_info : HolderCommitmentTransactionInfo , htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Signature > , Option < HTLCSource > ) > ) -> Result < ( ) , MonitorUpdateError > {
1137
- let txid = commitment_info. txid ( & self . onchain_tx_handler . channel_static_info . to_directed ( true ) , & self . secp_ctx ) ;
1136
+ fn provide_latest_holder_commitment_tx_info ( & mut self , commitment_info : HolderCommitmentTransaction , htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Signature > , Option < HTLCSource > ) > ) -> Result < ( ) , MonitorUpdateError > {
1137
+ let txid = commitment_info. txid ( & self . onchain_tx_handler . channel_transaction_parameters . to_directed ( true ) , & self . secp_ctx ) ;
1138
1138
1139
1139
// block for Rust 1.34 compat
1140
1140
let mut new_holder_commitment_tx = {
@@ -2506,7 +2506,7 @@ mod tests {
2506
2506
use ln:: channelmanager:: { PaymentPreimage , PaymentHash } ;
2507
2507
use ln:: onchaintx:: { OnchainTxHandler , InputDescriptors } ;
2508
2508
use ln:: chan_utils;
2509
- use ln:: chan_utils:: { HTLCOutputInCommitment , ChannelPublicKeys , ChannelStaticInfo , HolderCommitmentTransactionInfo } ;
2509
+ use ln:: chan_utils:: { HTLCOutputInCommitment , ChannelPublicKeys , ChannelTransactionParameters , HolderCommitmentTransaction } ;
2510
2510
use util:: test_utils:: TestLogger ;
2511
2511
use bitcoin:: secp256k1:: key:: { SecretKey , PublicKey } ;
2512
2512
use bitcoin:: secp256k1:: Secp256k1 ;
@@ -2584,7 +2584,7 @@ mod tests {
2584
2584
delayed_payment_basepoint : PublicKey :: from_secret_key ( & secp_ctx, & SecretKey :: from_slice ( & [ 47 ; 32 ] ) . unwrap ( ) ) ,
2585
2585
htlc_basepoint : PublicKey :: from_secret_key ( & secp_ctx, & SecretKey :: from_slice ( & [ 48 ; 32 ] ) . unwrap ( ) )
2586
2586
} ;
2587
- let channel_static_info = ChannelStaticInfo {
2587
+ let channel_parameters = ChannelTransactionParameters {
2588
2588
holder_pubkeys : keys. holder_channel_pubkeys . clone ( ) ,
2589
2589
counterparty_pubkeys,
2590
2590
holder_selected_contest_delay : 66 ,
@@ -2595,13 +2595,13 @@ mod tests {
2595
2595
// Prune with one old state and a holder commitment tx holding a few overlaps with the
2596
2596
// old state.
2597
2597
let mut monitor = ChannelMonitor :: new ( keys,
2598
- & PublicKey :: from_secret_key ( & secp_ctx, & SecretKey :: from_slice ( & [ 42 ; 32 ] ) . unwrap ( ) ) , 0 , & Script :: new ( ) ,
2599
- ( OutPoint { txid : Txid :: from_slice ( & [ 43 ; 32 ] ) . unwrap ( ) , index : 0 } , Script :: new ( ) ) ,
2600
- & channel_static_info ,
2601
- Script :: new ( ) , 46 , 0 ,
2602
- HolderCommitmentTransactionInfo :: dummy ( ) ) ;
2598
+ & PublicKey :: from_secret_key ( & secp_ctx, & SecretKey :: from_slice ( & [ 42 ; 32 ] ) . unwrap ( ) ) , 0 , & Script :: new ( ) ,
2599
+ ( OutPoint { txid : Txid :: from_slice ( & [ 43 ; 32 ] ) . unwrap ( ) , index : 0 } , Script :: new ( ) ) ,
2600
+ & channel_parameters ,
2601
+ Script :: new ( ) , 46 , 0 ,
2602
+ HolderCommitmentTransaction :: dummy ( ) ) ;
2603
2603
2604
- monitor. provide_latest_holder_commitment_tx_info ( HolderCommitmentTransactionInfo :: dummy ( ) , preimages_to_holder_htlcs ! ( preimages[ 0 ..10 ] ) ) . unwrap ( ) ;
2604
+ monitor. provide_latest_holder_commitment_tx_info ( HolderCommitmentTransaction :: dummy ( ) , preimages_to_holder_htlcs ! ( preimages[ 0 ..10 ] ) ) . unwrap ( ) ;
2605
2605
monitor. provide_latest_counterparty_commitment_tx_info ( & dummy_tx, preimages_slice_to_htlc_outputs ! ( preimages[ 5 ..15 ] ) , 281474976710655 , dummy_key, & logger) ;
2606
2606
monitor. provide_latest_counterparty_commitment_tx_info ( & dummy_tx, preimages_slice_to_htlc_outputs ! ( preimages[ 15 ..20 ] ) , 281474976710654 , dummy_key, & logger) ;
2607
2607
monitor. provide_latest_counterparty_commitment_tx_info ( & dummy_tx, preimages_slice_to_htlc_outputs ! ( preimages[ 17 ..20 ] ) , 281474976710653 , dummy_key, & logger) ;
@@ -2627,15 +2627,15 @@ mod tests {
2627
2627
2628
2628
// Now update holder commitment tx info, pruning only element 18 as we still care about the
2629
2629
// previous commitment tx's preimages too
2630
- monitor. provide_latest_holder_commitment_tx_info ( HolderCommitmentTransactionInfo :: dummy ( ) , preimages_to_holder_htlcs ! ( preimages[ 0 ..5 ] ) ) . unwrap ( ) ;
2630
+ monitor. provide_latest_holder_commitment_tx_info ( HolderCommitmentTransaction :: dummy ( ) , preimages_to_holder_htlcs ! ( preimages[ 0 ..5 ] ) ) . unwrap ( ) ;
2631
2631
secret[ 0 ..32 ] . clone_from_slice ( & hex:: decode ( "2273e227a5b7449b6e70f1fb4652864038b1cbf9cd7c043a7d6456b7fc275ad8" ) . unwrap ( ) ) ;
2632
2632
monitor. provide_secret ( 281474976710653 , secret. clone ( ) ) . unwrap ( ) ;
2633
2633
assert_eq ! ( monitor. payment_preimages. len( ) , 12 ) ;
2634
2634
test_preimages_exist ! ( & preimages[ 0 ..10 ] , monitor) ;
2635
2635
test_preimages_exist ! ( & preimages[ 18 ..20 ] , monitor) ;
2636
2636
2637
2637
// But if we do it again, we'll prune 5-10
2638
- monitor. provide_latest_holder_commitment_tx_info ( HolderCommitmentTransactionInfo :: dummy ( ) , preimages_to_holder_htlcs ! ( preimages[ 0 ..3 ] ) ) . unwrap ( ) ;
2638
+ monitor. provide_latest_holder_commitment_tx_info ( HolderCommitmentTransaction :: dummy ( ) , preimages_to_holder_htlcs ! ( preimages[ 0 ..3 ] ) ) . unwrap ( ) ;
2639
2639
secret[ 0 ..32 ] . clone_from_slice ( & hex:: decode ( "27cddaa5624534cb6cb9d7da077cf2b22ab21e9b506fd4998a51d54502e99116" ) . unwrap ( ) ) ;
2640
2640
monitor. provide_secret ( 281474976710652 , secret. clone ( ) ) . unwrap ( ) ;
2641
2641
assert_eq ! ( monitor. payment_preimages. len( ) , 5 ) ;
0 commit comments