diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index e594982914d..26f3b75d961 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -2129,9 +2129,12 @@ impl InitialRemoteCommitmentReceiver for FundedChannel where } impl PendingV2Channel where SP::Target: SignerProvider { + /// Prepare and start interactive transaction negotiation. + /// `change_destination_opt` - Optional destination for optional change; if None, default destination address is used. #[allow(dead_code)] // TODO(dual_funding): Remove once contribution to V2 channels is enabled fn begin_interactive_funding_tx_construction( &mut self, signer_provider: &SP, entropy_source: &ES, holder_node_id: PublicKey, + change_destination_opt: Option, ) -> Result, APIError> where ES::Target: EntropySource { @@ -2183,10 +2186,15 @@ impl PendingV2Channel where SP::Target: SignerProvider { ), })?; if let Some(change_value) = change_value_opt { - let change_script = signer_provider.get_destination_script(self.context.channel_keys_id).map_err( - |err| APIError::APIMisuseError { - err: format!("Failed to get change script as new destination script, {:?}", err), - })?; + let change_script = match change_destination_opt { + Some(script) => script, + None => { + signer_provider.get_destination_script(self.context.channel_keys_id).map_err( + |err| APIError::APIMisuseError { + err: format!("Failed to get change script as new destination script, {:?}", err), + })? + } + }; let mut change_output = TxOut { value: Amount::from_sat(change_value), script_pubkey: change_script,