}
impl<'a, 'db, 'tx> RuneUpdater<'a, 'db, 'tx> {
pub(super) fn index_runes(&mut self, index: usize, tx: &Transaction, txid: Txid) -> Result<()> {
let runestone = Runestone::from_transaction(tx);
// A mapping of rune ID to un-allocated balance of that rune
let mut unallocated: HashMap<u128, u128> = HashMap::new();
// Increment unallocated runes with the runes in this transaction's inputs
for input in &tx.input {
if let Some(guard) = self
.outpoint_to_balances
.remove(&input.previous_output.store())?
{
let buffer = guard.value();
let mut i = 0;
while i < buffer.len() {
let (id, len) = varint::decode(&buffer[i..])?;
i += len;
let (balance, len) = varint::decode(&buffer[i..])?;
i += len;
*unallocated.entry(id).or_default() += balance;
}
}
}
let burn = runestone
.as_ref()
.map(|runestone| runestone.burn)
.unwrap_or_default();
// A vector of allocated transaction output rune balances