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