@@ -452,7 +452,7 @@ pub(crate) enum ChannelMonitorUpdateStep {
452
452
commitment_txid : Txid ,
453
453
htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Box < HTLCSource > > ) > ,
454
454
commitment_number : u64 ,
455
- their_revocation_point : PublicKey ,
455
+ their_per_commitment_point : PublicKey ,
456
456
} ,
457
457
PaymentPreimage {
458
458
payment_preimage : PaymentPreimage ,
@@ -494,7 +494,7 @@ impl_writeable_tlv_based_enum_upgradable!(ChannelMonitorUpdateStep,
494
494
( 1 , LatestCounterpartyCommitmentTXInfo ) => {
495
495
( 0 , commitment_txid, required) ,
496
496
( 2 , commitment_number, required) ,
497
- ( 4 , their_revocation_point , required) ,
497
+ ( 4 , their_per_commitment_point , required) ,
498
498
( 6 , htlc_outputs, vec_type) ,
499
499
} ,
500
500
( 2 , PaymentPreimage ) => {
@@ -620,7 +620,7 @@ pub(crate) struct ChannelMonitorImpl<Signer: Sign> {
620
620
funding_redeemscript : Script ,
621
621
channel_value_satoshis : u64 ,
622
622
// first is the idx of the first of the two revocation points
623
- their_cur_revocation_points : Option < ( u64 , PublicKey , Option < PublicKey > ) > ,
623
+ their_cur_per_commitment_points : Option < ( u64 , PublicKey , Option < PublicKey > ) > ,
624
624
625
625
on_holder_tx_csv : u16 ,
626
626
@@ -753,7 +753,7 @@ impl<Signer: Sign> PartialEq for ChannelMonitorImpl<Signer> {
753
753
self . counterparty_commitment_params != other. counterparty_commitment_params ||
754
754
self . funding_redeemscript != other. funding_redeemscript ||
755
755
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 ||
757
757
self . on_holder_tx_csv != other. on_holder_tx_csv ||
758
758
self . commitment_secrets != other. commitment_secrets ||
759
759
self . counterparty_claimable_outpoints != other. counterparty_claimable_outpoints ||
@@ -828,7 +828,7 @@ impl<Signer: Sign> Writeable for ChannelMonitorImpl<Signer> {
828
828
self . funding_redeemscript . write ( writer) ?;
829
829
self . channel_value_satoshis . write ( writer) ?;
830
830
831
- match self . their_cur_revocation_points {
831
+ match self . their_cur_per_commitment_points {
832
832
Some ( ( idx, pubkey, second_option) ) => {
833
833
writer. write_all ( & byte_utils:: be48_to_array ( idx) ) ?;
834
834
writer. write_all ( & pubkey. serialize ( ) ) ?;
@@ -1020,7 +1020,7 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
1020
1020
counterparty_commitment_params,
1021
1021
funding_redeemscript,
1022
1022
channel_value_satoshis,
1023
- their_cur_revocation_points : None ,
1023
+ their_cur_per_commitment_points : None ,
1024
1024
1025
1025
on_holder_tx_csv : counterparty_channel_parameters. selected_contest_delay ,
1026
1026
@@ -1070,11 +1070,11 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
1070
1070
txid : Txid ,
1071
1071
htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Box < HTLCSource > > ) > ,
1072
1072
commitment_number : u64 ,
1073
- their_revocation_point : PublicKey ,
1073
+ their_per_commitment_point : PublicKey ,
1074
1074
logger : & L ,
1075
1075
) where L :: Target : Logger {
1076
1076
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)
1078
1078
}
1079
1079
1080
1080
#[ cfg( test) ]
@@ -1762,7 +1762,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1762
1762
Ok ( ( ) )
1763
1763
}
1764
1764
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 {
1766
1766
// TODO: Encrypt the htlc_outputs data with the single-hash of the commitment transaction
1767
1767
// so that a remote monitor doesn't learn anything unless there is a malicious close.
1768
1768
// (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> {
1777
1777
self . counterparty_claimable_outpoints . insert ( txid, htlc_outputs. clone ( ) ) ;
1778
1778
self . current_counterparty_commitment_number = commitment_number;
1779
1779
//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 {
1781
1781
Some ( old_points) => {
1782
1782
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 ) ) ) ;
1784
1784
} else if old_points. 0 == commitment_number + 2 {
1785
1785
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 ) ) ) ;
1787
1787
} 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 ) ) ;
1789
1789
}
1790
1790
} 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 ) ) ;
1792
1792
}
1793
1793
} ,
1794
1794
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 ) ) ;
1796
1796
}
1797
1797
}
1798
1798
let mut htlcs = Vec :: with_capacity ( htlc_outputs. len ( ) ) ;
@@ -1930,9 +1930,9 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1930
1930
ret = Err ( ( ) ) ;
1931
1931
}
1932
1932
}
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 } => {
1934
1934
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)
1936
1936
} ,
1937
1937
ChannelMonitorUpdateStep :: PaymentPreimage { payment_preimage } => {
1938
1938
log_trace ! ( logger, "Updating ChannelMonitor with payment preimage" ) ;
@@ -2121,18 +2121,18 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2121
2121
fn get_counterparty_htlc_output_claim_reqs ( & self , commitment_number : u64 , commitment_txid : Txid , tx : Option < & Transaction > ) -> Vec < PackageTemplate > {
2122
2122
let mut claimable_outpoints = Vec :: new ( ) ;
2123
2123
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 =
2126
2126
// If the counterparty commitment tx is the latest valid state, use their latest
2127
2127
// 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 ( ) {
2130
2130
// If counterparty commitment tx is the state previous to the latest valid state, use
2131
2131
// their previous per-commitment point (non-atomicity of revocation means it's valid for
2132
2132
// 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 }
2134
2134
} else { None } ;
2135
- if let Some ( revocation_point ) = revocation_point_option {
2135
+ if let Some ( per_commitment_point ) = per_commitment_point_option {
2136
2136
for ( _, & ( ref htlc, _) ) in htlc_outputs. iter ( ) . enumerate ( ) {
2137
2137
if let Some ( transaction_output_index) = htlc. transaction_output_index {
2138
2138
if let Some ( transaction) = tx {
@@ -2143,7 +2143,19 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2143
2143
}
2144
2144
let preimage = if htlc. offered { if let Some ( p) = self . payment_preimages . get ( & htlc. payment_hash ) { Some ( * p) } else { None } } else { None } ;
2145
2145
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
+ } ;
2147
2159
let aggregation = if !htlc. offered { false } else { true } ;
2148
2160
let counterparty_package = PackageTemplate :: build_package ( commitment_txid, transaction_output_index, counterparty_htlc_outp, htlc. cltv_expiry , aggregation, 0 ) ;
2149
2161
claimable_outpoints. push ( counterparty_package) ;
@@ -3095,7 +3107,7 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
3095
3107
let funding_redeemscript = Readable :: read ( reader) ?;
3096
3108
let channel_value_satoshis = Readable :: read ( reader) ?;
3097
3109
3098
- let their_cur_revocation_points = {
3110
+ let their_cur_per_commitment_points = {
3099
3111
let first_idx = <U48 as Readable >:: read ( reader) ?. 0 ;
3100
3112
if first_idx == 0 {
3101
3113
None
@@ -3284,7 +3296,7 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
3284
3296
counterparty_commitment_params,
3285
3297
funding_redeemscript,
3286
3298
channel_value_satoshis,
3287
- their_cur_revocation_points ,
3299
+ their_cur_per_commitment_points ,
3288
3300
3289
3301
on_holder_tx_csv,
3290
3302
0 commit comments