@@ -17,9 +17,9 @@ use bitcoin::{
1717use bitcoind:: bitcoincore_rpc:: RpcApi ;
1818
1919use crate :: {
20- error:: ProtocolError ,
2120 maker:: api:: recover_from_swap,
2221 protocol:: {
22+ error:: ProtocolError ,
2323 messages:: { MakerHello , MultisigPrivkey , PrivKeyHandover } ,
2424 Hash160 ,
2525 } ,
@@ -301,7 +301,7 @@ impl Maker {
301301 funding_output. value ,
302302 & funding_info. contract_redeemscript ,
303303 Amount :: from_sat ( message. next_fee_rate ) ,
304- ) ;
304+ ) ? ;
305305
306306 let ( tweakable_privkey, _) = self . wallet . read ( ) ?. get_tweakable_keypair ( ) ?;
307307 let multisig_privkey =
@@ -345,15 +345,18 @@ impl Maker {
345345 }
346346
347347 // Calculate output amounts for the next hop
348- let incoming_amount = message. confirmed_funding_txes . iter ( ) . fold ( 0u64 , |acc, fi| {
349- let index = find_funding_output_index ( fi) . unwrap ( ) ;
350- let txout = fi
351- . funding_tx
352- . output
353- . get ( index as usize )
354- . expect ( "output at index expected" ) ;
355- acc + txout. value . to_sat ( )
356- } ) ;
348+ let incoming_amount = message
349+ . confirmed_funding_txes
350+ . iter ( )
351+ . try_fold ( 0u64 , |acc, fi| {
352+ let index = find_funding_output_index ( fi) ?;
353+ let txout = fi
354+ . funding_tx
355+ . output
356+ . get ( index as usize )
357+ . expect ( "output at index expected" ) ;
358+ Ok :: < _ , MakerError > ( acc + txout. value . to_sat ( ) )
359+ } ) ?;
357360
358361 let calc_coinswap_fees = calculate_coinswap_fee (
359362 self . config . absolute_fee_sats ,
0 commit comments