Skip to content

Commit 81be24e

Browse files
author
Ludo Galabru
committed
fix: logs
1 parent 670bde6 commit 81be24e

File tree

1 file changed

+10
-19
lines changed
  • components/chainhook-event-observer/src/hord/db

1 file changed

+10
-19
lines changed

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

+10-19
Original file line numberDiff line numberDiff line change
@@ -1448,29 +1448,13 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
14481448
if index == tx_cursor.1 {
14491449
break;
14501450
}
1451-
// ctx.try_log(|logger| {
1452-
// slog::info!(logger, "Adding {} from output #{}", output_value, index)
1453-
// });
14541451
sats_out += output_value;
14551452
}
14561453
sats_out += ordinal_offset;
1457-
// ctx.try_log(|logger| {
1458-
// slog::info!(
1459-
// logger,
1460-
// "Adding offset {ordinal_offset} to sats_out {sats_out}"
1461-
// )
1462-
// });
14631454

14641455
let mut sats_in = 0;
14651456
for input in tx.inputs.iter() {
14661457
sats_in += input.txin_value;
1467-
// ctx.try_log(|logger| {
1468-
// slog::info!(
1469-
// logger,
1470-
// "Adding txin_value {txin_value} to sats_in {sats_in} (txin: {})",
1471-
// hex::encode(&txin)
1472-
// )
1473-
// });
14741458

14751459
if sats_out < sats_in {
14761460
ordinal_offset = sats_out - (sats_in - input.txin_value);
@@ -1600,9 +1584,12 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
16001584
ordinal_offset = sats_out - (sats_in - input.txin_value);
16011585
ordinal_block_number = input.block_height;
16021586

1603-
// ctx.try_log(|logger| slog::info!(logger, "Block {ordinal_block_number} / Tx {} / [in:{sats_in}, out:{sats_out}]: {block_height} -> {ordinal_block_number}:{ordinal_offset} -> {}:{vout}",
1604-
// hex::encode(&txid_n),
1605-
// hex::encode(&txin)));
1587+
ctx.try_log(|logger| slog::info!(logger, "Block {ordinal_block_number} / Tx {} / [in:{sats_in}, out:{sats_out}]: {} -> {ordinal_block_number}:{ordinal_offset} -> {}:{}",
1588+
hex::encode(&lazy_tx.txid),
1589+
input.block_height,
1590+
hex::encode(&input.txin),
1591+
input.vout,
1592+
));
16061593
tx_cursor = (input.txin.clone(), input.vout as usize);
16071594
break;
16081595
}
@@ -1755,16 +1742,19 @@ impl LazyBlock {
17551742
&self,
17561743
searched_txid: &[u8],
17571744
) -> Option<LazyBlockTransaction> {
1745+
// println!("{:?}", hex::encode(searched_txid));
17581746
let mut entry = None;
17591747
let mut cursor = Cursor::new(&self.bytes);
17601748
let mut cumulated_offset = 0;
17611749
let mut i = 0;
17621750
while entry.is_none() {
17631751
let pos = self.get_transactions_data_pos() + cumulated_offset;
17641752
let (inputs_len, outputs_len, size) = self.get_transaction_format(i);
1753+
// println!("{inputs_len} / {outputs_len} / {size}");
17651754
cursor.set_position(pos as u64);
17661755
let mut txid = [0u8; 8];
17671756
let _ = cursor.read_exact(&mut txid);
1757+
// println!("-> {}", hex::encode(txid));
17681758
if searched_txid.eq(&txid) {
17691759
entry = Some(self.get_lazy_transaction_at_pos(
17701760
&mut cursor,
@@ -1813,6 +1803,7 @@ impl<'a> Iterator for LazyBlockTransactionIterator<'a> {
18131803
}
18141804
let pos = self.lazy_block.get_transactions_data_pos() + self.cumulated_offset;
18151805
let (inputs_len, outputs_len, size) = self.lazy_block.get_transaction_format(self.tx_index);
1806+
// println!("{inputs_len} / {outputs_len} / {size}");
18161807
let mut cursor = Cursor::new(&self.lazy_block.bytes);
18171808
cursor.set_position(pos as u64);
18181809
let mut txid = [0u8; 8];

0 commit comments

Comments
 (0)