Skip to content

Commit

Permalink
fix: inscription fee
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalabru committed Mar 23, 2023
1 parent e5ac34d commit 2ac3022
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion components/chainhook-cli/src/scan/bitcoin.rs
Expand Up @@ -200,7 +200,7 @@ pub async fn scan_bitcoin_chain_with_predicate(
&transaction.transaction_identifier,
&ctx_,
);
let (block_number, block_offset) = match res {
let (block_number, block_offset, _) = match res {
Ok(res) => res,
Err(err) => {
println!("{err}");
Expand Down
21 changes: 15 additions & 6 deletions components/chainhook-event-observer/src/indexer/bitcoin/mod.rs
Expand Up @@ -274,10 +274,13 @@ pub fn standardize_bitcoin_block(
sats_in += value;
inputs.push(TxIn {
previous_output: OutPoint {
txid: input
.txid
.expect("not provided for coinbase txs")
.to_string(),
txid: format!(
"0x{}",
input
.txid
.expect("not provided for coinbase txs")
.to_string()
),
vout: input.vout.expect("not provided for coinbase txs"),
block_height: input.prevout.expect("not provided for coinbase txs").height,
value,
Expand Down Expand Up @@ -366,6 +369,12 @@ fn try_parse_ordinal_operation(
index: 0,
};

let inscription_fee = tx
.vout
.get(0)
.and_then(|o| Some(o.value.to_sat()))
.unwrap_or(0);

let no_content_bytes = vec![];
let inscription_content_bytes = inscription.body().unwrap_or(&no_content_bytes);

Expand All @@ -385,12 +394,12 @@ fn try_parse_ordinal_operation(
content_length: inscription_content_bytes.len(),
inscription_id: inscription_id.to_string(),
inscriber_address,
inscription_fee,
inscription_number: 0,
inscription_fee: 0,
ordinal_number: 0,
ordinal_block_height: 0,
ordinal_offset: 0,
outpoint_post_inscription: format!("{}:0:0", tx.txid.clone()),
satpoint_post_inscription: format!("{}:0:0", tx.txid.clone()),
},
));
}
Expand Down

0 comments on commit 2ac3022

Please sign in to comment.