Skip to content

Commit 2ac3022

Browse files
author
Ludo Galabru
committed
fix: inscription fee
1 parent e5ac34d commit 2ac3022

File tree

2 files changed

+16
-7
lines changed
  • components
    • chainhook-cli/src/scan
    • chainhook-event-observer/src/indexer/bitcoin

2 files changed

+16
-7
lines changed

components/chainhook-cli/src/scan/bitcoin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ pub async fn scan_bitcoin_chain_with_predicate(
200200
&transaction.transaction_identifier,
201201
&ctx_,
202202
);
203-
let (block_number, block_offset) = match res {
203+
let (block_number, block_offset, _) = match res {
204204
Ok(res) => res,
205205
Err(err) => {
206206
println!("{err}");

components/chainhook-event-observer/src/indexer/bitcoin/mod.rs

+15-6
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,13 @@ pub fn standardize_bitcoin_block(
274274
sats_in += value;
275275
inputs.push(TxIn {
276276
previous_output: OutPoint {
277-
txid: input
278-
.txid
279-
.expect("not provided for coinbase txs")
280-
.to_string(),
277+
txid: format!(
278+
"0x{}",
279+
input
280+
.txid
281+
.expect("not provided for coinbase txs")
282+
.to_string()
283+
),
281284
vout: input.vout.expect("not provided for coinbase txs"),
282285
block_height: input.prevout.expect("not provided for coinbase txs").height,
283286
value,
@@ -366,6 +369,12 @@ fn try_parse_ordinal_operation(
366369
index: 0,
367370
};
368371

372+
let inscription_fee = tx
373+
.vout
374+
.get(0)
375+
.and_then(|o| Some(o.value.to_sat()))
376+
.unwrap_or(0);
377+
369378
let no_content_bytes = vec![];
370379
let inscription_content_bytes = inscription.body().unwrap_or(&no_content_bytes);
371380

@@ -385,12 +394,12 @@ fn try_parse_ordinal_operation(
385394
content_length: inscription_content_bytes.len(),
386395
inscription_id: inscription_id.to_string(),
387396
inscriber_address,
397+
inscription_fee,
388398
inscription_number: 0,
389-
inscription_fee: 0,
390399
ordinal_number: 0,
391400
ordinal_block_height: 0,
392401
ordinal_offset: 0,
393-
outpoint_post_inscription: format!("{}:0:0", tx.txid.clone()),
402+
satpoint_post_inscription: format!("{}:0:0", tx.txid.clone()),
394403
},
395404
));
396405
}

0 commit comments

Comments
 (0)