let mut coinbase_inputs = VecDeque::new();
let h = Height(self.height);
if h.subsidy() > 0 {
let start = h.starting_sat();
coinbase_inputs.push_front((start.n(), (start + h.subsidy()).n()));
self.sat_ranges_since_flush += 1;
}
for (tx_offset, (tx, txid)) in block.txdata.iter().enumerate().skip(1) {
log::trace!("Indexing transaction {tx_offset}…");
let mut input_sat_ranges = VecDeque::new();
for input in &tx.input {
let key = input.previous_output.store();
let sat_ranges = match self.range_cache.remove(&key) {
Some(sat_ranges) => {
self.outputs_cached += 1;
sat_ranges
}
None => outpoint_to_sat_ranges
.remove(&key)?
.ok_or_else(|| anyhow!("Could not find outpoint {} in index", input.previous_output))?
.value()
.to_vec(),
};
for chunk in sat_ranges.chunks_exact(11) {
input_sat_ranges.push_back(SatRange::load(chunk.try_into().unwrap()));