When querying a spent output, the unwrap() here will panic:
chain/src/txhashset/utxo_view.rs
/// Find the complete input/s info, use chain database data according to inputs
pub fn get_complete_inputs(
&self,
inputs: &Vec<Input>,
) -> Result<HashMap<Commitment, OutputEx>, Error> {
let mut complete_inputs: HashMap<Commitment, OutputEx> = HashMap::new();
for input in inputs {
if let Ok(ofph) = self.batch.get_output_pos_height(&input.commitment()) {
let output = match ofph.features {
OutputFeatures::Plain | OutputFeatures::Coinbase => self
.output_i_pmmr
.get_data(ofph.position)
.unwrap() <<<< panic here
.into_output(),
OutputFeatures::SigLocked => self
.output_ii_pmmr
.get_data(ofph.position)
.unwrap() <<<< or panic here
.into_output(),
};
...
The only possible reason is that I could have forgot cleaning the output position height index when an output is spent. The original PR is here.
When querying a spent output, the
unwrap()
here will panic:The only possible reason is that I could have forgot cleaning the output position height index when an output is spent. The original PR is here.
To be checked and confirmed.