@@ -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
@@ -368,16 +368,18 @@ pub trait BaseSign {
368368 -> Result < ( Signature , Signature ) , ( ) > ;
369369
370370 /// Set the counterparty static channel data, including basepoints,
371- /// counterparty_selected/holder_selected_contest_delay and funding outpoint.
372- /// This is done as soon as the funding outpoint is known. Since these are static channel data,
373- /// they MUST NOT be allowed to change to different values once set.
371+ /// counterparty_selected/holder_selected_contest_delay and funding outpoint. This is usually
372+ /// done immediately upon signer derivation, unless the channel has yet to be funded, in which
373+ /// case it is done as soon as the funding outpoint is known. Since these are static channel
374+ /// data, they MUST NOT be allowed to change to different values once set. If the channel
375+ /// parameters are already known, any further calls should act as a no-op.
374376 ///
375377 /// channel_parameters.is_populated() MUST be true.
376378 ///
377379 /// We bind holder_selected_contest_delay late here for API convenience.
378380 ///
379381 /// Will be called before any signatures are applied.
380- fn ready_channel ( & mut self , channel_parameters : & ChannelTransactionParameters ) ;
382+ fn provide_channel_parameters ( & mut self , channel_parameters : & ChannelTransactionParameters ) ;
381383}
382384
383385/// A cloneable signer.
@@ -580,39 +582,39 @@ impl InMemorySigner {
580582 }
581583
582584 /// Counterparty pubkeys.
583- /// Will panic if ready_channel wasn't called.
585+ /// Will panic if provide_channel_parameters wasn't called.
584586 pub fn counterparty_pubkeys ( & self ) -> & ChannelPublicKeys { & self . get_channel_parameters ( ) . counterparty_parameters . as_ref ( ) . unwrap ( ) . pubkeys }
585587
586588 /// The contest_delay value specified by our counterparty and applied on holder-broadcastable
587589 /// transactions, ie the amount of time that we have to wait to recover our funds if we
588590 /// broadcast a transaction.
589- /// Will panic if ready_channel wasn't called.
591+ /// Will panic if provide_channel_parameters wasn't called.
590592 pub fn counterparty_selected_contest_delay ( & self ) -> u16 { self . get_channel_parameters ( ) . counterparty_parameters . as_ref ( ) . unwrap ( ) . selected_contest_delay }
591593
592594 /// The contest_delay value specified by us and applied on transactions broadcastable
593595 /// by our counterparty, ie the amount of time that they have to wait to recover their funds
594596 /// if they broadcast a transaction.
595- /// Will panic if ready_channel wasn't called.
597+ /// Will panic if provide_channel_parameters wasn't called.
596598 pub fn holder_selected_contest_delay ( & self ) -> u16 { self . get_channel_parameters ( ) . holder_selected_contest_delay }
597599
598600 /// Whether the holder is the initiator
599- /// Will panic if ready_channel wasn't called.
601+ /// Will panic if provide_channel_parameters wasn't called.
600602 pub fn is_outbound ( & self ) -> bool { self . get_channel_parameters ( ) . is_outbound_from_holder }
601603
602604 /// Funding outpoint
603- /// Will panic if ready_channel wasn't called.
605+ /// Will panic if provide_channel_parameters wasn't called.
604606 pub fn funding_outpoint ( & self ) -> & OutPoint { self . get_channel_parameters ( ) . funding_outpoint . as_ref ( ) . unwrap ( ) }
605607
606608 /// Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
607609 /// building transactions.
608610 ///
609- /// Will panic if ready_channel wasn't called.
611+ /// Will panic if provide_channel_parameters wasn't called.
610612 pub fn get_channel_parameters ( & self ) -> & ChannelTransactionParameters {
611613 self . channel_parameters . as_ref ( ) . unwrap ( )
612614 }
613615
614616 /// Whether anchors should be used.
615- /// Will panic if ready_channel wasn't called.
617+ /// Will panic if provide_channel_parameters wasn't called.
616618 pub fn opt_anchors ( & self ) -> bool {
617619 self . get_channel_parameters ( ) . opt_anchors . is_some ( )
618620 }
@@ -816,8 +818,10 @@ impl BaseSign for InMemorySigner {
816818 Ok ( ( sign ( secp_ctx, & msghash, & self . node_secret ) , sign ( secp_ctx, & msghash, & self . funding_key ) ) )
817819 }
818820
819- fn ready_channel ( & mut self , channel_parameters : & ChannelTransactionParameters ) {
820- assert ! ( self . channel_parameters. is_none( ) , "Acceptance already noted" ) ;
821+ fn provide_channel_parameters ( & mut self , channel_parameters : & ChannelTransactionParameters ) {
822+ if self . channel_parameters . is_some ( ) {
823+ return ;
824+ }
821825 assert ! ( channel_parameters. is_populated( ) , "Channel parameters must be fully populated" ) ;
822826 self . channel_parameters = Some ( channel_parameters. clone ( ) ) ;
823827 }
0 commit comments