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