@@ -2213,9 +2213,12 @@ impl<SP: Deref> InitialRemoteCommitmentReceiver<SP> for FundedChannel<SP> where
22132213}
22142214
22152215impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2216+ /// Prepare and start interactive transaction negotiation.
2217+ /// `change_destination_opt` - Optional destination for optional change; if None, default destination address is used.
22162218 #[allow(dead_code)] // TODO(dual_funding): Remove once contribution to V2 channels is enabled
22172219 fn begin_interactive_funding_tx_construction<ES: Deref>(
22182220 &mut self, signer_provider: &SP, entropy_source: &ES, holder_node_id: PublicKey,
2221+ change_destination_opt: Option<ScriptBuf>,
22192222 ) -> Result<Option<InteractiveTxMessageSend>, APIError>
22202223 where ES::Target: EntropySource
22212224 {
@@ -2267,10 +2270,15 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
22672270 ),
22682271 })?;
22692272 if let Some(change_value) = change_value_opt {
2270- let change_script = signer_provider.get_destination_script(self.context.channel_keys_id).map_err(
2271- |err| APIError::APIMisuseError {
2272- err: format!("Failed to get change script as new destination script, {:?}", err),
2273- })?;
2273+ let change_script = match change_destination_opt {
2274+ Some(script) => script,
2275+ None => {
2276+ signer_provider.get_destination_script(self.context.channel_keys_id).map_err(
2277+ |err| APIError::APIMisuseError {
2278+ err: format!("Failed to get change script as new destination script, {:?}", err),
2279+ })?
2280+ }
2281+ };
22742282 let mut change_output = TxOut {
22752283 value: Amount::from_sat(change_value),
22762284 script_pubkey: change_script,
0 commit comments