Skip to content

Commit e8ee3ab

Browse files
author
Ludo Galabru
committed
fix: traversals algo
1 parent 3494997 commit e8ee3ab

File tree

1 file changed

+3
-11
lines changed
  • components/chainhook-event-observer/src/hord/db

1 file changed

+3
-11
lines changed

components/chainhook-event-observer/src/hord/db/mod.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -1558,22 +1558,14 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
15581558
sats_in += input.txin_value;
15591559

15601560
if sats_out < sats_in {
1561+
traversals_cache.insert((ordinal_block_number, tx_cursor.0), lazy_tx.clone());
15611562
ordinal_offset = sats_out - (sats_in - input.txin_value);
15621563
ordinal_block_number = input.block_height;
1563-
1564-
ctx.try_log(|logger| slog::info!(logger, "Block {ordinal_block_number} / Tx {} / [in:{sats_in}, out:{sats_out}]: {} -> {ordinal_block_number}:{ordinal_offset} -> {}:{}",
1565-
hex::encode(&lazy_tx.txid),
1566-
input.block_height,
1567-
hex::encode(&input.txin),
1568-
input.vout,
1569-
));
15701564
tx_cursor = (input.txin.clone(), input.vout as usize);
15711565
break;
15721566
}
15731567
}
15741568

1575-
traversals_cache.insert((ordinal_block_number, tx_cursor.0), lazy_tx);
1576-
15771569
if sats_in == 0 {
15781570
ctx.try_log(|logger| {
15791571
slog::error!(
@@ -1607,14 +1599,14 @@ pub struct LazyBlock {
16071599
pub tx_len: u16,
16081600
}
16091601

1610-
#[derive(Debug)]
1602+
#[derive(Debug, Clone)]
16111603
pub struct LazyBlockTransaction {
16121604
pub txid: [u8; 8],
16131605
pub inputs: Vec<LazyBlockTransactionInput>,
16141606
pub outputs: Vec<u64>,
16151607
}
16161608

1617-
#[derive(Debug)]
1609+
#[derive(Debug, Clone)]
16181610
pub struct LazyBlockTransactionInput {
16191611
pub txin: [u8; 8],
16201612
pub block_height: u32,

0 commit comments

Comments
 (0)