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