@@ -2129,9 +2129,12 @@ impl<SP: Deref> InitialRemoteCommitmentReceiver<SP> for FundedChannel<SP> where
2129
2129
}
2130
2130
2131
2131
impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2132
+ /// Prepare and start interactive transaction negotiation.
2133
+ /// `change_destination_opt` - Optional destination for optional change; if None, default destination address is used.
2132
2134
#[allow(dead_code)] // TODO(dual_funding): Remove once contribution to V2 channels is enabled
2133
2135
fn begin_interactive_funding_tx_construction<ES: Deref>(
2134
2136
&mut self, signer_provider: &SP, entropy_source: &ES, holder_node_id: PublicKey,
2137
+ change_destination_opt: Option<ScriptBuf>,
2135
2138
) -> Result<Option<InteractiveTxMessageSend>, APIError>
2136
2139
where ES::Target: EntropySource
2137
2140
{
@@ -2183,10 +2186,15 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2183
2186
),
2184
2187
})?;
2185
2188
if let Some(change_value) = change_value_opt {
2186
- let change_script = signer_provider.get_destination_script(self.context.channel_keys_id).map_err(
2187
- |err| APIError::APIMisuseError {
2188
- err: format!("Failed to get change script as new destination script, {:?}", err),
2189
- })?;
2189
+ let change_script = match change_destination_opt {
2190
+ Some(script) => script,
2191
+ None => {
2192
+ signer_provider.get_destination_script(self.context.channel_keys_id).map_err(
2193
+ |err| APIError::APIMisuseError {
2194
+ err: format!("Failed to get change script as new destination script, {:?}", err),
2195
+ })?
2196
+ }
2197
+ };
2190
2198
let mut change_output = TxOut {
2191
2199
value: Amount::from_sat(change_value),
2192
2200
script_pubkey: change_script,
0 commit comments