checks non-finalized chain for unspent utxos before checking disk (#6513)
This commit is contained in:
parent
8edbf7990d
commit
6ed4b6632d
|
@ -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`.
|
||||
|
|
Loading…
Reference in New Issue