diff --git a/zebra-state/src/service/check/utxo.rs b/zebra-state/src/service/check/utxo.rs index d29e5bca0..73f36d05f 100644 --- a/zebra-state/src/service/check/utxo.rs +++ b/zebra-state/src/service/check/utxo.rs @@ -152,25 +152,19 @@ fn transparent_spend_chain_order( }); } - match ( - non_finalized_chain_unspent_utxos.get(&spend), - finalized_state.utxo(&spend), - ) { - (None, None) => { - // we don't keep spent UTXOs in the finalized state, - // so all we can say is that it's missing from both - // the finalized and non-finalized chains - // (it might have been spent in the finalized state, - // or it might never have existed in this chain) - Err(MissingTransparentOutput { - outpoint: spend, - location: "the non-finalized and finalized chain", - }) - } - - (Some(utxo), _) => Ok(utxo.clone()), - (_, Some(utxo)) => Ok(utxo), - } + non_finalized_chain_unspent_utxos + .get(&spend) + .cloned() + .or_else(|| finalized_state.utxo(&spend)) + // we don't keep spent UTXOs in the finalized state, + // so all we can say is that it's missing from both + // the finalized and non-finalized chains + // (it might have been spent in the finalized state, + // or it might never have existed in this chain) + .ok_or(MissingTransparentOutput { + outpoint: spend, + location: "the non-finalized and finalized chain", + }) } /// Check that `utxo` is spendable, based on the coinbase `spend_restriction`.