@@ -2239,9 +2239,12 @@ impl<SP: Deref> InitialRemoteCommitmentReceiver<SP> for FundedChannel<SP> where
2239
2239
}
2240
2240
2241
2241
impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2242
+ /// Prepare and start interactive transaction negotiation.
2243
+ /// `change_destination_opt` - Optional destination for optional change; if None, default destination address is used.
2242
2244
#[allow(dead_code)] // TODO(dual_funding): Remove once contribution to V2 channels is enabled
2243
2245
fn begin_interactive_funding_tx_construction<ES: Deref>(
2244
2246
&mut self, signer_provider: &SP, entropy_source: &ES, holder_node_id: PublicKey,
2247
+ change_destination_opt: Option<ScriptBuf>,
2245
2248
) -> Result<Option<InteractiveTxMessageSend>, APIError>
2246
2249
where ES::Target: EntropySource
2247
2250
{
@@ -2293,10 +2296,15 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2293
2296
),
2294
2297
})?;
2295
2298
if let Some(change_value) = change_value_opt {
2296
- let change_script = signer_provider.get_destination_script(self.context.channel_keys_id).map_err(
2297
- |err| APIError::APIMisuseError {
2298
- err: format!("Failed to get change script as new destination script, {:?}", err),
2299
- })?;
2299
+ let change_script = match change_destination_opt {
2300
+ Some(script) => script,
2301
+ None => {
2302
+ signer_provider.get_destination_script(self.context.channel_keys_id).map_err(
2303
+ |err| APIError::APIMisuseError {
2304
+ err: format!("Failed to get change script as new destination script, {:?}", err),
2305
+ })?
2306
+ }
2307
+ };
2300
2308
let mut change_output = TxOut {
2301
2309
value: Amount::from_sat(change_value),
2302
2310
script_pubkey: change_script,
0 commit comments