checks non-finalized chain for unspent utxos before checking disk (#6513)
This commit is contained in:
parent
8edbf7990d
commit
6ed4b6632d
|
|
@ -152,27 +152,21 @@ fn transparent_spend_chain_order(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
match (
|
non_finalized_chain_unspent_utxos
|
||||||
non_finalized_chain_unspent_utxos.get(&spend),
|
.get(&spend)
|
||||||
finalized_state.utxo(&spend),
|
.cloned()
|
||||||
) {
|
.or_else(|| finalized_state.utxo(&spend))
|
||||||
(None, None) => {
|
|
||||||
// we don't keep spent UTXOs in the finalized state,
|
// we don't keep spent UTXOs in the finalized state,
|
||||||
// so all we can say is that it's missing from both
|
// so all we can say is that it's missing from both
|
||||||
// the finalized and non-finalized chains
|
// the finalized and non-finalized chains
|
||||||
// (it might have been spent in the finalized state,
|
// (it might have been spent in the finalized state,
|
||||||
// or it might never have existed in this chain)
|
// or it might never have existed in this chain)
|
||||||
Err(MissingTransparentOutput {
|
.ok_or(MissingTransparentOutput {
|
||||||
outpoint: spend,
|
outpoint: spend,
|
||||||
location: "the non-finalized and finalized chain",
|
location: "the non-finalized and finalized chain",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
(Some(utxo), _) => Ok(utxo.clone()),
|
|
||||||
(_, Some(utxo)) => Ok(utxo),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Check that `utxo` is spendable, based on the coinbase `spend_restriction`.
|
/// Check that `utxo` is spendable, based on the coinbase `spend_restriction`.
|
||||||
///
|
///
|
||||||
/// # Consensus
|
/// # Consensus
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue