Skip to content

Commit

Permalink
btcio/rpc/types: Update deserialize_txid
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibek Pandey authored and storopoli committed Sep 5, 2024
1 parent 643d7d3 commit fe4dbb6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crates/btcio/src/rpc/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bitcoin::{
absolute::Height, address::NetworkUnchecked, consensus, Address, Amount, BlockHash,
SignedAmount, Transaction, Txid,
absolute::Height, address::NetworkUnchecked, consensus, hashes::Hash, Address, Amount,
BlockHash, SignedAmount, Transaction, Txid,
};
use bitcoind_json_rpc_types::v26::GetTransactionDetail;
use serde::{
Expand Down Expand Up @@ -258,8 +258,10 @@ where
E: de::Error,
{
trace!("Deserializing txid: {}", v);
let txid =
consensus::encode::deserialize_hex::<Txid>(v).expect("Txid deserialization failed");
let mut idraw = hex::decode(v).expect("Invalid hex string");
idraw.reverse();
let txid = Txid::from_slice(&idraw).expect("Txid parse Error");
trace!("Deserialized txid: {}", txid);
Ok(txid)
}
}
Expand Down

0 comments on commit fe4dbb6

Please sign in to comment.