fix: build error

This commit is contained in:
Ludo Galabru
2023-07-21 16:11:19 -04:00
parent 50de33e578
commit 5c3bcf42fc
3 changed files with 10 additions and 6 deletions

View File

@@ -523,7 +523,7 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
Command::Scan(ScanCommand::Inscription(cmd)) => {
let config: Config =
Config::default(cmd.regtest, cmd.testnet, cmd.mainnet, &cmd.config_path)?;
let _ = download_ordinals_dataset_if_required(&config, ctx).await;
let inscriptions_db_conn =

View File

@@ -1727,7 +1727,7 @@ impl LazyBlock {
for input in tx.vin.iter() {
// txin - 8 first bytes
let txin = {
let txid = hex::decode(input.txid.unwrap().to_string()).unwrap();
let txid = hex::decode(input.txid.as_ref().unwrap().to_string()).unwrap();
[
txid[0], txid[1], txid[2], txid[3], txid[4], txid[5], txid[6], txid[7],
]

View File

@@ -3,7 +3,7 @@ pub mod ordinals;
use chainhook_sdk::bitcoincore_rpc::bitcoin::hashes::hex::FromHex;
use chainhook_sdk::bitcoincore_rpc::bitcoin::{Address, Network, Script};
use chainhook_sdk::bitcoincore_rpc_json::bitcoin::Witness;
use chainhook_sdk::bitcoincore_rpc_json::bitcoin::{Txid, Witness};
use chainhook_sdk::types::{
BitcoinBlockData, BitcoinNetwork, OrdinalInscriptionCurseType, OrdinalInscriptionRevealData,
OrdinalInscriptionTransferData, OrdinalOperation, TransactionIdentifier,
@@ -102,12 +102,16 @@ pub fn parse_ordinal_operations(
let mut operations = vec![];
for (input_index, input) in tx.vin.iter().enumerate() {
if let Some(ref witness_data) = input.txinwitness {
let witness = Witness::from_vec(witness_data.clone());
let witness_data_hex: Vec<Vec<u8>> = witness_data
.iter()
.map(|w| hex::decode(w).unwrap())
.collect();
let witness = Witness::from_vec(witness_data_hex.clone());
let mut inscription = match InscriptionParser::parse(&witness) {
Ok(inscription) => inscription,
Err(_e) => {
let mut cursed_inscription = None;
for bytes in witness_data.iter() {
for bytes in witness_data_hex.iter() {
let script = Script::from(bytes.to_vec());
let parser = InscriptionParser {
instructions: script.instructions().peekable(),
@@ -129,7 +133,7 @@ pub fn parse_ordinal_operations(
};
let inscription_id = InscriptionId {
txid: tx.txid.clone(),
txid: Txid::from_hex(&tx.txid).unwrap(),
index: input_index as u32,
};