Skip to content

Commit f34e0c6

Browse files
committed
Rename KeysInterface ready_channel to provide_channel_parameters
Now that ready_channel is also called on startup upon deserializing channels, we opt to rename it to a more indicative name.
1 parent 7ba553c commit f34e0c6

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

lightning/src/chain/keysinterface.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pub enum SpendableOutputDescriptor {
161161
///
162162
/// To derive the revocation_pubkey provided here (which is used in the witness
163163
/// script generation), you must pass the counterparty revocation_basepoint (which appears in the
164-
/// call to Sign::ready_channel) and the provided per_commitment point
164+
/// call to Sign::provide_channel_parameters) and the provided per_commitment point
165165
/// to chan_utils::derive_public_revocation_key.
166166
///
167167
/// The witness script which is hashed and included in the output script_pubkey may be
@@ -377,7 +377,7 @@ pub trait BaseSign {
377377
/// We bind holder_selected_contest_delay late here for API convenience.
378378
///
379379
/// Will be called before any signatures are applied.
380-
fn ready_channel(&mut self, channel_parameters: &ChannelTransactionParameters);
380+
fn provide_channel_parameters(&mut self, channel_parameters: &ChannelTransactionParameters);
381381
}
382382

383383
/// A cloneable signer.
@@ -580,39 +580,39 @@ impl InMemorySigner {
580580
}
581581

582582
/// Counterparty pubkeys.
583-
/// Will panic if ready_channel wasn't called.
583+
/// Will panic if provide_channel_parameters wasn't called.
584584
pub fn counterparty_pubkeys(&self) -> &ChannelPublicKeys { &self.get_channel_parameters().counterparty_parameters.as_ref().unwrap().pubkeys }
585585

586586
/// The contest_delay value specified by our counterparty and applied on holder-broadcastable
587587
/// transactions, ie the amount of time that we have to wait to recover our funds if we
588588
/// broadcast a transaction.
589-
/// Will panic if ready_channel wasn't called.
589+
/// Will panic if provide_channel_parameters wasn't called.
590590
pub fn counterparty_selected_contest_delay(&self) -> u16 { self.get_channel_parameters().counterparty_parameters.as_ref().unwrap().selected_contest_delay }
591591

592592
/// The contest_delay value specified by us and applied on transactions broadcastable
593593
/// by our counterparty, ie the amount of time that they have to wait to recover their funds
594594
/// if they broadcast a transaction.
595-
/// Will panic if ready_channel wasn't called.
595+
/// Will panic if provide_channel_parameters wasn't called.
596596
pub fn holder_selected_contest_delay(&self) -> u16 { self.get_channel_parameters().holder_selected_contest_delay }
597597

598598
/// Whether the holder is the initiator
599-
/// Will panic if ready_channel wasn't called.
599+
/// Will panic if provide_channel_parameters wasn't called.
600600
pub fn is_outbound(&self) -> bool { self.get_channel_parameters().is_outbound_from_holder }
601601

602602
/// Funding outpoint
603-
/// Will panic if ready_channel wasn't called.
603+
/// Will panic if provide_channel_parameters wasn't called.
604604
pub fn funding_outpoint(&self) -> &OutPoint { self.get_channel_parameters().funding_outpoint.as_ref().unwrap() }
605605

606606
/// Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
607607
/// building transactions.
608608
///
609-
/// Will panic if ready_channel wasn't called.
609+
/// Will panic if provide_channel_parameters wasn't called.
610610
pub fn get_channel_parameters(&self) -> &ChannelTransactionParameters {
611611
self.channel_parameters.as_ref().unwrap()
612612
}
613613

614614
/// Whether anchors should be used.
615-
/// Will panic if ready_channel wasn't called.
615+
/// Will panic if provide_channel_parameters wasn't called.
616616
pub fn opt_anchors(&self) -> bool {
617617
self.get_channel_parameters().opt_anchors.is_some()
618618
}
@@ -816,7 +816,7 @@ impl BaseSign for InMemorySigner {
816816
Ok((sign(secp_ctx, &msghash, &self.node_secret), sign(secp_ctx, &msghash, &self.funding_key)))
817817
}
818818

819-
fn ready_channel(&mut self, channel_parameters: &ChannelTransactionParameters) {
819+
fn provide_channel_parameters(&mut self, channel_parameters: &ChannelTransactionParameters) {
820820
assert!(self.channel_parameters.is_none(), "Acceptance already noted");
821821
assert!(channel_parameters.is_populated(), "Channel parameters must be fully populated");
822822
self.channel_parameters = Some(channel_parameters.clone());

lightning/src/chain/onchaintx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ impl<'a, K: KeysInterface> ReadableArgs<(&'a K, u64, [u8; 32])> for OnchainTxHan
334334
}
335335

336336
let mut signer = keys_manager.derive_channel_signer(channel_value_satoshis, channel_keys_id);
337-
signer.ready_channel(&channel_parameters);
337+
signer.provide_channel_parameters(&channel_parameters);
338338

339339
let pending_claim_requests_len: u64 = Readable::read(reader)?;
340340
let mut pending_claim_requests = HashMap::with_capacity(cmp::min(pending_claim_requests_len as usize, MAX_ALLOC_SIZE / 128));

lightning/src/ln/channel.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,7 +2221,7 @@ impl<Signer: Sign> Channel<Signer> {
22212221
self.channel_transaction_parameters.funding_outpoint = Some(funding_txo);
22222222
// This is an externally observable change before we finish all our checks. In particular
22232223
// funding_created_signature may fail.
2224-
self.holder_signer.ready_channel(&self.channel_transaction_parameters);
2224+
self.holder_signer.provide_channel_parameters(&self.channel_transaction_parameters);
22252225

22262226
let (counterparty_initial_commitment_txid, initial_commitment_tx, signature) = match self.funding_created_signature(&msg.signature, logger) {
22272227
Ok(res) => res,
@@ -5246,7 +5246,7 @@ impl<Signer: Sign> Channel<Signer> {
52465246
}
52475247

52485248
self.channel_transaction_parameters.funding_outpoint = Some(funding_txo);
5249-
self.holder_signer.ready_channel(&self.channel_transaction_parameters);
5249+
self.holder_signer.provide_channel_parameters(&self.channel_transaction_parameters);
52505250

52515251
let signature = match self.get_outbound_funding_created_signature(logger) {
52525252
Ok(res) => res,
@@ -7321,7 +7321,7 @@ mod tests {
73217321
selected_contest_delay: 144
73227322
});
73237323
chan.channel_transaction_parameters.funding_outpoint = Some(funding_info);
7324-
signer.ready_channel(&chan.channel_transaction_parameters);
7324+
signer.provide_channel_parameters(&chan.channel_transaction_parameters);
73257325

73267326
assert_eq!(counterparty_pubkeys.payment_point.serialize()[..],
73277327
hex::decode("032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991").unwrap()[..]);

lightning/src/util/enforcing_trait_impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ impl BaseSign for EnforcingSigner {
215215
self.inner.sign_channel_announcement(msg, secp_ctx)
216216
}
217217

218-
fn ready_channel(&mut self, channel_parameters: &ChannelTransactionParameters) {
219-
self.inner.ready_channel(channel_parameters)
218+
fn provide_channel_parameters(&mut self, channel_parameters: &ChannelTransactionParameters) {
219+
self.inner.provide_channel_parameters(channel_parameters)
220220
}
221221
}
222222

0 commit comments

Comments
 (0)