Bubble up unrecoverable errors instead of expecting

This does introduce the ability of expressing incorrect combinations
of the enums `SwapFailed` and `Reason`, but these are just internal
to this function and it's terser that way.
This commit is contained in:
Lucas Soriano del Pino 2020-10-16 11:43:24 +11:00
parent 1251681cfd
commit bae391ff9c

View File

@ -224,8 +224,6 @@ where
Either::Right(_) => return Err(SwapFailed::AfterBtcLock(Reason::BtcExpired)),
};
// NOTE: If any of this fails, Bob will never be able to take the monero.
// Therefore, there is no way to handle these errors other than aborting
let tx_redeem_sig = tx_redeem
.extract_signature_by_key(tx_redeem_published, b.public())
.map_err(|_| SwapFailed::AfterBtcRedeem(Reason::BtcRedeemSignature))?;