wtx: &mut WriteTransaction,
block: BlockData,
value_cache: &mut HashMap<OutPoint, u64>,
) -> Result<()> {
Reorg::detect_reorg(&block, self.height, self.index)?;
let start = Instant::now();
let mut sat_ranges_written = 0;
let mut outputs_in_block = 0;
log::info!(
"Block {} at {} with {} transactions…",
self.height,
timestamp(block.header.time),
block.txdata.len()
);
// If value_receiver still has values something went wrong with the last block
// Could be an assert, shouldn't recover from this and commit the last block
let Err(TryRecvError::Empty) = value_receiver.try_recv() else {
return Err(anyhow!("Previous block did not consume all input values"));
};
let mut outpoint_to_value = wtx.open_table(OUTPOINT_TO_VALUE)?;
let index_inscriptions = self.height >= index.first_inscription_height;
if index_inscriptions {
// Send all missing input outpoints to be fetched right away
let txids = block
.txdata