@@ -2227,7 +2227,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2227
2227
&mut self, signer_provider: &SP, entropy_source: &ES, holder_node_id: PublicKey,
2228
2228
change_destination_opt: Option<ScriptBuf>,
2229
2229
prev_funding_input: Option<(TxIn, TransactionU16LenLimited)>,
2230
- ) -> Result<Option<InteractiveTxMessageSend>, APIError >
2230
+ ) -> Result<Option<InteractiveTxMessageSend>, ChannelError >
2231
2231
where ES::Target: EntropySource
2232
2232
{
2233
2233
let mut funding_inputs = Vec::new();
@@ -2237,14 +2237,13 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2237
2237
funding_inputs.push(prev_funding_input);
2238
2238
}
2239
2239
2240
- let funding_inputs_prev_outputs = DualFundingChannelContext::txouts_from_input_prev_txs(&funding_inputs)
2241
- .map_err(|err| APIError::APIMisuseError { err: err.to_string() })?;
2240
+ let funding_inputs_prev_outputs = DualFundingChannelContext::txouts_from_input_prev_txs(&funding_inputs)?;
2242
2241
2243
2242
let total_input_satoshis: u64 = funding_inputs_prev_outputs.iter().map(|txout| txout.value.to_sat()).sum();
2244
2243
if total_input_satoshis < self.dual_funding_context.our_funding_satoshis {
2245
- return Err(APIError::APIMisuseError {
2246
- err: format!( "Total value of funding inputs must be at least funding amount. It was {} sats",
2247
- total_input_satoshis) } );
2244
+ return Err(ChannelError::Warn(format!(
2245
+ "Total value of funding inputs must be at least funding amount. It was {} sats", total_input_satoshis ,
2246
+ )) );
2248
2247
}
2249
2248
2250
2249
// Add output for funding tx
@@ -2276,19 +2275,18 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2276
2275
&funding_inputs_prev_outputs, &funding_outputs,
2277
2276
self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2278
2277
self.context.holder_dust_limit_satoshis,
2279
- ).map_err(|err| APIError::APIMisuseError {
2280
- err: format!("Insufficient inputs, cannot cover intended contribution of {} and fees; {}",
2281
- self.dual_funding_context.our_funding_satoshis, err
2282
- ),
2283
- })?;
2278
+ ).map_err(|err| ChannelError::Warn(format!(
2279
+ "Insufficient inputs, cannot cover intended contribution of {} and fees; {}",
2280
+ self.dual_funding_context.our_funding_satoshis, err
2281
+ )))?;
2284
2282
if let Some(change_value) = change_value_opt {
2285
2283
let change_script = if let Some(script) = change_destination_opt {
2286
2284
script
2287
2285
} else {
2288
2286
signer_provider.get_destination_script(self.context.channel_keys_id)
2289
- .map_err(|err| APIError::APIMisuseError {
2290
- err: format!( "Failed to get change script as new destination script, {:?}", err) ,
2291
- } )?
2287
+ .map_err(|err| ChannelError::Warn(format!(
2288
+ "Failed to get change script as new destination script, {:?}", err,
2289
+ )) )?
2292
2290
};
2293
2291
let mut change_output = TxOut {
2294
2292
value: Amount::from_sat(change_value),
@@ -2317,7 +2315,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2317
2315
expected_remote_shared_funding_output,
2318
2316
};
2319
2317
let mut tx_constructor = InteractiveTxConstructor::new(constructor_args)
2320
- .map_err(|_| APIError::APIMisuseError { err: "Incorrect shared output provided".into() } )?;
2318
+ .map_err(|_| ChannelError::Warn( "Incorrect shared output provided".into()) )?;
2321
2319
let msg = tx_constructor.take_initiator_first_message();
2322
2320
2323
2321
self.interactive_tx_constructor = Some(tx_constructor);
0 commit comments