@@ -452,7 +452,7 @@ pub(crate) enum ChannelMonitorUpdateStep {
452452 commitment_txid : Txid ,
453453 htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Box < HTLCSource > > ) > ,
454454 commitment_number : u64 ,
455- their_revocation_point : PublicKey ,
455+ their_per_commitment_point : PublicKey ,
456456 } ,
457457 PaymentPreimage {
458458 payment_preimage : PaymentPreimage ,
@@ -494,7 +494,7 @@ impl_writeable_tlv_based_enum_upgradable!(ChannelMonitorUpdateStep,
494494 ( 1 , LatestCounterpartyCommitmentTXInfo ) => {
495495 ( 0 , commitment_txid, required) ,
496496 ( 2 , commitment_number, required) ,
497- ( 4 , their_revocation_point , required) ,
497+ ( 4 , their_per_commitment_point , required) ,
498498 ( 6 , htlc_outputs, vec_type) ,
499499 } ,
500500 ( 2 , PaymentPreimage ) => {
@@ -619,8 +619,8 @@ pub(crate) struct ChannelMonitorImpl<Signer: Sign> {
619619 counterparty_commitment_params : CounterpartyCommitmentParameters ,
620620 funding_redeemscript : Script ,
621621 channel_value_satoshis : u64 ,
622- // first is the idx of the first of the two revocation points
623- their_cur_revocation_points : Option < ( u64 , PublicKey , Option < PublicKey > ) > ,
622+ // first is the idx of the first of the two per-commitment points
623+ their_cur_per_commitment_points : Option < ( u64 , PublicKey , Option < PublicKey > ) > ,
624624
625625 on_holder_tx_csv : u16 ,
626626
@@ -753,7 +753,7 @@ impl<Signer: Sign> PartialEq for ChannelMonitorImpl<Signer> {
753753 self . counterparty_commitment_params != other. counterparty_commitment_params ||
754754 self . funding_redeemscript != other. funding_redeemscript ||
755755 self . channel_value_satoshis != other. channel_value_satoshis ||
756- self . their_cur_revocation_points != other. their_cur_revocation_points ||
756+ self . their_cur_per_commitment_points != other. their_cur_per_commitment_points ||
757757 self . on_holder_tx_csv != other. on_holder_tx_csv ||
758758 self . commitment_secrets != other. commitment_secrets ||
759759 self . counterparty_claimable_outpoints != other. counterparty_claimable_outpoints ||
@@ -828,7 +828,7 @@ impl<Signer: Sign> Writeable for ChannelMonitorImpl<Signer> {
828828 self . funding_redeemscript . write ( writer) ?;
829829 self . channel_value_satoshis . write ( writer) ?;
830830
831- match self . their_cur_revocation_points {
831+ match self . their_cur_per_commitment_points {
832832 Some ( ( idx, pubkey, second_option) ) => {
833833 writer. write_all ( & byte_utils:: be48_to_array ( idx) ) ?;
834834 writer. write_all ( & pubkey. serialize ( ) ) ?;
@@ -1020,7 +1020,7 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
10201020 counterparty_commitment_params,
10211021 funding_redeemscript,
10221022 channel_value_satoshis,
1023- their_cur_revocation_points : None ,
1023+ their_cur_per_commitment_points : None ,
10241024
10251025 on_holder_tx_csv : counterparty_channel_parameters. selected_contest_delay ,
10261026
@@ -1070,11 +1070,11 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
10701070 txid : Txid ,
10711071 htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Box < HTLCSource > > ) > ,
10721072 commitment_number : u64 ,
1073- their_revocation_point : PublicKey ,
1073+ their_per_commitment_point : PublicKey ,
10741074 logger : & L ,
10751075 ) where L :: Target : Logger {
10761076 self . inner . lock ( ) . unwrap ( ) . provide_latest_counterparty_commitment_tx (
1077- txid, htlc_outputs, commitment_number, their_revocation_point , logger)
1077+ txid, htlc_outputs, commitment_number, their_per_commitment_point , logger)
10781078 }
10791079
10801080 #[ cfg( test) ]
@@ -1762,7 +1762,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
17621762 Ok ( ( ) )
17631763 }
17641764
1765- pub ( crate ) fn provide_latest_counterparty_commitment_tx < L : Deref > ( & mut self , txid : Txid , htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Box < HTLCSource > > ) > , commitment_number : u64 , their_revocation_point : PublicKey , logger : & L ) where L :: Target : Logger {
1765+ pub ( crate ) fn provide_latest_counterparty_commitment_tx < L : Deref > ( & mut self , txid : Txid , htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Box < HTLCSource > > ) > , commitment_number : u64 , their_per_commitment_point : PublicKey , logger : & L ) where L :: Target : Logger {
17661766 // TODO: Encrypt the htlc_outputs data with the single-hash of the commitment transaction
17671767 // so that a remote monitor doesn't learn anything unless there is a malicious close.
17681768 // (only maybe, sadly we cant do the same for local info, as we need to be aware of
@@ -1777,22 +1777,22 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
17771777 self . counterparty_claimable_outpoints . insert ( txid, htlc_outputs. clone ( ) ) ;
17781778 self . current_counterparty_commitment_number = commitment_number;
17791779 //TODO: Merge this into the other per-counterparty-transaction output storage stuff
1780- match self . their_cur_revocation_points {
1780+ match self . their_cur_per_commitment_points {
17811781 Some ( old_points) => {
17821782 if old_points. 0 == commitment_number + 1 {
1783- self . their_cur_revocation_points = Some ( ( old_points. 0 , old_points. 1 , Some ( their_revocation_point ) ) ) ;
1783+ self . their_cur_per_commitment_points = Some ( ( old_points. 0 , old_points. 1 , Some ( their_per_commitment_point ) ) ) ;
17841784 } else if old_points. 0 == commitment_number + 2 {
17851785 if let Some ( old_second_point) = old_points. 2 {
1786- self . their_cur_revocation_points = Some ( ( old_points. 0 - 1 , old_second_point, Some ( their_revocation_point ) ) ) ;
1786+ self . their_cur_per_commitment_points = Some ( ( old_points. 0 - 1 , old_second_point, Some ( their_per_commitment_point ) ) ) ;
17871787 } else {
1788- self . their_cur_revocation_points = Some ( ( commitment_number, their_revocation_point , None ) ) ;
1788+ self . their_cur_per_commitment_points = Some ( ( commitment_number, their_per_commitment_point , None ) ) ;
17891789 }
17901790 } else {
1791- self . their_cur_revocation_points = Some ( ( commitment_number, their_revocation_point , None ) ) ;
1791+ self . their_cur_per_commitment_points = Some ( ( commitment_number, their_per_commitment_point , None ) ) ;
17921792 }
17931793 } ,
17941794 None => {
1795- self . their_cur_revocation_points = Some ( ( commitment_number, their_revocation_point , None ) ) ;
1795+ self . their_cur_per_commitment_points = Some ( ( commitment_number, their_per_commitment_point , None ) ) ;
17961796 }
17971797 }
17981798 let mut htlcs = Vec :: with_capacity ( htlc_outputs. len ( ) ) ;
@@ -1930,9 +1930,9 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
19301930 ret = Err ( ( ) ) ;
19311931 }
19321932 }
1933- ChannelMonitorUpdateStep :: LatestCounterpartyCommitmentTXInfo { commitment_txid, htlc_outputs, commitment_number, their_revocation_point } => {
1933+ ChannelMonitorUpdateStep :: LatestCounterpartyCommitmentTXInfo { commitment_txid, htlc_outputs, commitment_number, their_per_commitment_point } => {
19341934 log_trace ! ( logger, "Updating ChannelMonitor with latest counterparty commitment transaction info" ) ;
1935- self . provide_latest_counterparty_commitment_tx ( * commitment_txid, htlc_outputs. clone ( ) , * commitment_number, * their_revocation_point , logger)
1935+ self . provide_latest_counterparty_commitment_tx ( * commitment_txid, htlc_outputs. clone ( ) , * commitment_number, * their_per_commitment_point , logger)
19361936 } ,
19371937 ChannelMonitorUpdateStep :: PaymentPreimage { payment_preimage } => {
19381938 log_trace ! ( logger, "Updating ChannelMonitor with payment preimage" ) ;
@@ -2121,18 +2121,18 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
21212121 fn get_counterparty_htlc_output_claim_reqs ( & self , commitment_number : u64 , commitment_txid : Txid , tx : Option < & Transaction > ) -> Vec < PackageTemplate > {
21222122 let mut claimable_outpoints = Vec :: new ( ) ;
21232123 if let Some ( htlc_outputs) = self . counterparty_claimable_outpoints . get ( & commitment_txid) {
2124- if let Some ( revocation_points ) = self . their_cur_revocation_points {
2125- let revocation_point_option =
2124+ if let Some ( per_commitment_points ) = self . their_cur_per_commitment_points {
2125+ let per_commitment_point_option =
21262126 // If the counterparty commitment tx is the latest valid state, use their latest
21272127 // per-commitment point
2128- if revocation_points . 0 == commitment_number { Some ( & revocation_points . 1 ) }
2129- else if let Some ( point) = revocation_points . 2 . as_ref ( ) {
2128+ if per_commitment_points . 0 == commitment_number { Some ( & per_commitment_points . 1 ) }
2129+ else if let Some ( point) = per_commitment_points . 2 . as_ref ( ) {
21302130 // If counterparty commitment tx is the state previous to the latest valid state, use
21312131 // their previous per-commitment point (non-atomicity of revocation means it's valid for
21322132 // them to temporarily have two valid commitment txns from our viewpoint)
2133- if revocation_points . 0 == commitment_number + 1 { Some ( point) } else { None }
2133+ if per_commitment_points . 0 == commitment_number + 1 { Some ( point) } else { None }
21342134 } else { None } ;
2135- if let Some ( revocation_point ) = revocation_point_option {
2135+ if let Some ( per_commitment_point ) = per_commitment_point_option {
21362136 for ( _, & ( ref htlc, _) ) in htlc_outputs. iter ( ) . enumerate ( ) {
21372137 if let Some ( transaction_output_index) = htlc. transaction_output_index {
21382138 if let Some ( transaction) = tx {
@@ -2143,7 +2143,19 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
21432143 }
21442144 let preimage = if htlc. offered { if let Some ( p) = self . payment_preimages . get ( & htlc. payment_hash ) { Some ( * p) } else { None } } else { None } ;
21452145 if preimage. is_some ( ) || !htlc. offered {
2146- let counterparty_htlc_outp = if htlc. offered { PackageSolvingData :: CounterpartyOfferedHTLCOutput ( CounterpartyOfferedHTLCOutput :: build ( * revocation_point, self . counterparty_commitment_params . counterparty_delayed_payment_base_key , self . counterparty_commitment_params . counterparty_htlc_base_key , preimage. unwrap ( ) , htlc. clone ( ) ) ) } else { PackageSolvingData :: CounterpartyReceivedHTLCOutput ( CounterpartyReceivedHTLCOutput :: build ( * revocation_point, self . counterparty_commitment_params . counterparty_delayed_payment_base_key , self . counterparty_commitment_params . counterparty_htlc_base_key , htlc. clone ( ) ) ) } ;
2146+ let counterparty_htlc_outp = if htlc. offered {
2147+ PackageSolvingData :: CounterpartyOfferedHTLCOutput (
2148+ CounterpartyOfferedHTLCOutput :: build ( * per_commitment_point,
2149+ self . counterparty_commitment_params . counterparty_delayed_payment_base_key ,
2150+ self . counterparty_commitment_params . counterparty_htlc_base_key ,
2151+ preimage. unwrap ( ) , htlc. clone ( ) ) )
2152+ } else {
2153+ PackageSolvingData :: CounterpartyReceivedHTLCOutput (
2154+ CounterpartyReceivedHTLCOutput :: build ( * per_commitment_point,
2155+ self . counterparty_commitment_params . counterparty_delayed_payment_base_key ,
2156+ self . counterparty_commitment_params . counterparty_htlc_base_key ,
2157+ htlc. clone ( ) ) )
2158+ } ;
21472159 let aggregation = if !htlc. offered { false } else { true } ;
21482160 let counterparty_package = PackageTemplate :: build_package ( commitment_txid, transaction_output_index, counterparty_htlc_outp, htlc. cltv_expiry , aggregation, 0 ) ;
21492161 claimable_outpoints. push ( counterparty_package) ;
@@ -3095,7 +3107,7 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
30953107 let funding_redeemscript = Readable :: read ( reader) ?;
30963108 let channel_value_satoshis = Readable :: read ( reader) ?;
30973109
3098- let their_cur_revocation_points = {
3110+ let their_cur_per_commitment_points = {
30993111 let first_idx = <U48 as Readable >:: read ( reader) ?. 0 ;
31003112 if first_idx == 0 {
31013113 None
@@ -3284,7 +3296,7 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
32843296 counterparty_commitment_params,
32853297 funding_redeemscript,
32863298 channel_value_satoshis,
3287- their_cur_revocation_points ,
3299+ their_cur_per_commitment_points ,
32883300
32893301 on_holder_tx_csv,
32903302
0 commit comments