@@ -2229,7 +2229,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
22292229 &mut self, signer_provider: &SP, entropy_source: &ES, holder_node_id: PublicKey,
22302230 change_destination_opt: Option<ScriptBuf>,
22312231 prev_funding_input: Option<(TxIn, TransactionU16LenLimited)>,
2232- ) -> Result<Option<InteractiveTxMessageSend>, APIError >
2232+ ) -> Result<Option<InteractiveTxMessageSend>, ChannelError >
22332233 where ES::Target: EntropySource
22342234 {
22352235 let mut funding_inputs = Vec::new();
@@ -2239,14 +2239,13 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
22392239 funding_inputs.push(prev_funding_input);
22402240 }
22412241
2242- let funding_inputs_prev_outputs = DualFundingChannelContext::txouts_from_input_prev_txs(&funding_inputs)
2243- .map_err(|err| APIError::APIMisuseError { err: err.to_string() })?;
2242+ let funding_inputs_prev_outputs = DualFundingChannelContext::txouts_from_input_prev_txs(&funding_inputs)?;
22442243
22452244 let total_input_satoshis: u64 = funding_inputs_prev_outputs.iter().map(|txout| txout.value.to_sat()).sum();
22462245 if total_input_satoshis < self.dual_funding_context.our_funding_satoshis {
2247- return Err(APIError::APIMisuseError {
2248- err: format!( "Total value of funding inputs must be at least funding amount. It was {} sats",
2249- total_input_satoshis) } );
2246+ return Err(ChannelError::Warn(format!(
2247+ "Total value of funding inputs must be at least funding amount. It was {} sats", total_input_satoshis ,
2248+ )) );
22502249 }
22512250
22522251 // Add output for funding tx
@@ -2278,19 +2277,18 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
22782277 &funding_inputs_prev_outputs, &funding_outputs,
22792278 self.dual_funding_context.funding_feerate_sat_per_1000_weight,
22802279 self.context.holder_dust_limit_satoshis,
2281- ).map_err(|err| APIError::APIMisuseError {
2282- err: format!("Insufficient inputs, cannot cover intended contribution of {} and fees; {}",
2283- self.dual_funding_context.our_funding_satoshis, err
2284- ),
2285- })?;
2280+ ).map_err(|err| ChannelError::Warn(format!(
2281+ "Insufficient inputs, cannot cover intended contribution of {} and fees; {}",
2282+ self.dual_funding_context.our_funding_satoshis, err
2283+ )))?;
22862284 if let Some(change_value) = change_value_opt {
22872285 let change_script = if let Some(script) = change_destination_opt {
22882286 script
22892287 } else {
22902288 signer_provider.get_destination_script(self.context.channel_keys_id)
2291- .map_err(|err| APIError::APIMisuseError {
2292- err: format!( "Failed to get change script as new destination script, {:?}", err) ,
2293- } )?
2289+ .map_err(|err| ChannelError::Warn(format!(
2290+ "Failed to get change script as new destination script, {:?}", err,
2291+ )) )?
22942292 };
22952293 let mut change_output = TxOut {
22962294 value: Amount::from_sat(change_value),
@@ -2319,7 +2317,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
23192317 expected_remote_shared_funding_output,
23202318 };
23212319 let mut tx_constructor = InteractiveTxConstructor::new(constructor_args)
2322- .map_err(|_| APIError::APIMisuseError { err: "Incorrect shared output provided".into() } )?;
2320+ .map_err(|_| ChannelError::Warn( "Incorrect shared output provided".into()) )?;
23232321 let msg = tx_constructor.take_initiator_first_message();
23242322
23252323 self.interactive_tx_constructor = Some(tx_constructor);
0 commit comments