@@ -1252,7 +1252,7 @@ pub(crate) struct ShutdownResult {
12521252struct HolderCommitmentPoint {
12531253 transaction_number: u64,
12541254 point: PublicKey,
1255- next_point : Option<PublicKey>,
1255+ pending_next_point : Option<PublicKey>,
12561256}
12571257
12581258impl HolderCommitmentPoint {
@@ -1263,12 +1263,12 @@ impl HolderCommitmentPoint {
12631263 Some(HolderCommitmentPoint {
12641264 transaction_number: INITIAL_COMMITMENT_NUMBER,
12651265 point: signer.as_ref().get_per_commitment_point(INITIAL_COMMITMENT_NUMBER, secp_ctx).ok()?,
1266- next_point : signer.as_ref().get_per_commitment_point(INITIAL_COMMITMENT_NUMBER - 1, secp_ctx).ok(),
1266+ pending_next_point : signer.as_ref().get_per_commitment_point(INITIAL_COMMITMENT_NUMBER - 1, secp_ctx).ok(),
12671267 })
12681268 }
12691269
12701270 pub fn can_advance(&self) -> bool {
1271- self.next_point .is_some()
1271+ self.pending_next_point .is_some()
12721272 }
12731273
12741274 pub fn transaction_number(&self) -> u64 {
@@ -1279,32 +1279,29 @@ impl HolderCommitmentPoint {
12791279 self.point
12801280 }
12811281
1282- pub fn next_point(&self) -> Option<PublicKey> {
1283- self.next_point
1284- }
1285-
1286- /// If we are pending the next commitment point, this method tries asking the signer again.
1282+ /// If we are pending advancing the next commitment point, this method tries asking the signer
1283+ /// again.
12871284 pub fn try_resolve_pending<SP: Deref, L: Deref>(
12881285 &mut self, signer: &ChannelSignerType<SP>, secp_ctx: &Secp256k1<secp256k1::All>, logger: &L,
12891286 ) where
12901287 SP::Target: SignerProvider,
12911288 L::Target: Logger,
12921289 {
12931290 if !self.can_advance() {
1294- let next =
1291+ let pending_next_point =
12951292 signer.as_ref().get_per_commitment_point(self.transaction_number - 1, secp_ctx);
1296- if let Ok(next ) = next {
1293+ if let Ok(point ) = pending_next_point {
12971294 log_trace!(
12981295 logger,
1299- "Retrieved next per-commitment point {}",
1296+ "Retrieved per-commitment point {} for next advancement ",
13001297 self.transaction_number - 1
13011298 );
1302- self.next_point = Some(next );
1299+ self.pending_next_point = Some(point );
13031300 } else {
13041301 log_trace!(
13051302 logger,
1306- "Next per-commitment point {} is pending ",
1307- self.transaction_number
1303+ "Pending per-commitment point {} for next advancement ",
1304+ self.transaction_number - 1
13081305 );
13091306 }
13101307 }
@@ -1327,11 +1324,11 @@ impl HolderCommitmentPoint {
13271324 SP::Target: SignerProvider,
13281325 L::Target: Logger,
13291326 {
1330- if let Some(next_point) = self.next_point {
1327+ if let Some(next_point) = self.pending_next_point {
13311328 *self = Self {
13321329 transaction_number: self.transaction_number - 1,
13331330 point: next_point,
1334- next_point : None,
1331+ pending_next_point : None,
13351332 };
13361333
13371334 self.try_resolve_pending(signer, secp_ctx, logger);
@@ -13202,7 +13199,7 @@ where
1320213199
1320313200 // `HolderCommitmentPoint::point` will become optional when async signing is implemented.
1320413201 let holder_commitment_point = Some(self.holder_commitment_point.point());
13205- let holder_commitment_point_next_advance = self.holder_commitment_point.next_point() ;
13202+ let holder_commitment_point_pending_next = self.holder_commitment_point.pending_next_point ;
1320613203
1320713204 write_tlv_fields!(writer, {
1320813205 (0, self.context.announcement_sigs, option),
@@ -13241,7 +13238,7 @@ where
1324113238 (41, holding_cell_blinding_points, optional_vec),
1324213239 (43, malformed_htlcs, optional_vec), // Added in 0.0.119
1324313240 (45, holder_commitment_point, option),
13244- (47, holder_commitment_point_next_advance , option),
13241+ (47, holder_commitment_point_pending_next , option),
1324513242 (49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
1324613243 (51, is_manual_broadcast, option), // Added in 0.0.124
1324713244 (53, funding_tx_broadcast_safe_event_emitted, option), // Added in 0.0.124
@@ -13602,7 +13599,7 @@ where
1360213599 let mut monitor_pending_update_adds: Option<Vec<msgs::UpdateAddHTLC>> = None;
1360313600
1360413601 let mut holder_commitment_point_opt: Option<PublicKey> = None;
13605- let mut holder_commitment_point_next_advance_opt : Option<PublicKey> = None;
13602+ let mut holder_commitment_point_pending_next_opt : Option<PublicKey> = None;
1360613603 let mut is_manual_broadcast = None;
1360713604
1360813605 let mut pending_funding = Some(Vec::new());
@@ -13643,7 +13640,7 @@ where
1364313640 (41, holding_cell_blinding_points_opt, optional_vec),
1364413641 (43, malformed_htlcs, optional_vec), // Added in 0.0.119
1364513642 (45, holder_commitment_point_opt, option),
13646- (47, holder_commitment_point_next_advance_opt , option),
13643+ (47, holder_commitment_point_pending_next_opt , option),
1364713644 (49, local_initiated_shutdown, option),
1364813645 (51, is_manual_broadcast, option),
1364913646 (53, funding_tx_broadcast_safe_event_emitted, option),
@@ -13832,27 +13829,27 @@ where
1383213829 // signer be available so that we can immediately populate the current commitment point. Channel
1383313830 // restoration will fail if this is not possible.
1383413831 let holder_commitment_point =
13835- match (holder_commitment_point_opt, holder_commitment_point_next_advance_opt ) {
13836- (Some(point), next_point ) => HolderCommitmentPoint {
13832+ match (holder_commitment_point_opt, holder_commitment_point_pending_next_opt ) {
13833+ (Some(point), pending_next_point ) => HolderCommitmentPoint {
1383713834 transaction_number: holder_commitment_transaction_number,
1383813835 point,
13839- next_point ,
13836+ pending_next_point ,
1384013837 },
1384113838 (_, _) => {
1384213839 let point = holder_signer.get_per_commitment_point(holder_commitment_transaction_number, &secp_ctx)
1384313840 .expect("Must be able to derive the current commitment point upon channel restoration");
13844- let next_point = holder_signer
13841+ let pending_next_point = holder_signer
1384513842 .get_per_commitment_point(
1384613843 holder_commitment_transaction_number - 1,
1384713844 &secp_ctx,
1384813845 )
1384913846 .expect(
13850- "Must be able to derive the next commitment point upon channel restoration",
13847+ "Must be able to derive the pending next commitment point upon channel restoration",
1385113848 );
1385213849 HolderCommitmentPoint {
1385313850 transaction_number: holder_commitment_transaction_number,
1385413851 point,
13855- next_point : Some(next_point ),
13852+ pending_next_point : Some(pending_next_point ),
1385613853 }
1385713854 },
1385813855 };
0 commit comments