Skip to content

Commit 5c3bcf4

Browse files
author
Ludo Galabru
committedJul 21, 2023
fix: build error
1 parent 50de33e commit 5c3bcf4

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed
 

‎components/hord-cli/src/cli/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
523523
Command::Scan(ScanCommand::Inscription(cmd)) => {
524524
let config: Config =
525525
Config::default(cmd.regtest, cmd.testnet, cmd.mainnet, &cmd.config_path)?;
526-
526+
527527
let _ = download_ordinals_dataset_if_required(&config, ctx).await;
528528

529529
let inscriptions_db_conn =

‎components/hord-cli/src/db/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,7 @@ impl LazyBlock {
17271727
for input in tx.vin.iter() {
17281728
// txin - 8 first bytes
17291729
let txin = {
1730-
let txid = hex::decode(input.txid.unwrap().to_string()).unwrap();
1730+
let txid = hex::decode(input.txid.as_ref().unwrap().to_string()).unwrap();
17311731
[
17321732
txid[0], txid[1], txid[2], txid[3], txid[4], txid[5], txid[6], txid[7],
17331733
]

‎components/hord-cli/src/hord/mod.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub mod ordinals;
33

44
use chainhook_sdk::bitcoincore_rpc::bitcoin::hashes::hex::FromHex;
55
use chainhook_sdk::bitcoincore_rpc::bitcoin::{Address, Network, Script};
6-
use chainhook_sdk::bitcoincore_rpc_json::bitcoin::Witness;
6+
use chainhook_sdk::bitcoincore_rpc_json::bitcoin::{Txid, Witness};
77
use chainhook_sdk::types::{
88
BitcoinBlockData, BitcoinNetwork, OrdinalInscriptionCurseType, OrdinalInscriptionRevealData,
99
OrdinalInscriptionTransferData, OrdinalOperation, TransactionIdentifier,
@@ -102,12 +102,16 @@ pub fn parse_ordinal_operations(
102102
let mut operations = vec![];
103103
for (input_index, input) in tx.vin.iter().enumerate() {
104104
if let Some(ref witness_data) = input.txinwitness {
105-
let witness = Witness::from_vec(witness_data.clone());
105+
let witness_data_hex: Vec<Vec<u8>> = witness_data
106+
.iter()
107+
.map(|w| hex::decode(w).unwrap())
108+
.collect();
109+
let witness = Witness::from_vec(witness_data_hex.clone());
106110
let mut inscription = match InscriptionParser::parse(&witness) {
107111
Ok(inscription) => inscription,
108112
Err(_e) => {
109113
let mut cursed_inscription = None;
110-
for bytes in witness_data.iter() {
114+
for bytes in witness_data_hex.iter() {
111115
let script = Script::from(bytes.to_vec());
112116
let parser = InscriptionParser {
113117
instructions: script.instructions().peekable(),
@@ -129,7 +133,7 @@ pub fn parse_ordinal_operations(
129133
};
130134

131135
let inscription_id = InscriptionId {
132-
txid: tx.txid.clone(),
136+
txid: Txid::from_hex(&tx.txid).unwrap(),
133137
index: input_index as u32,
134138
};
135139

0 commit comments

Comments
 (0)