@@ -5,6 +5,7 @@ use schemars::JsonSchema;
55use serde:: Serialize ;
66use transparent:: bundle:: { TxIn , TxOut } ;
77use zaino_state:: { FetchServiceError , FetchServiceSubscriber , LightWalletIndexer , ZcashIndexer } ;
8+ use zcash_encoding:: ReverseHex ;
89use zcash_protocol:: {
910 TxId ,
1011 consensus:: { self , BlockHeight } ,
@@ -15,7 +16,7 @@ use crate::components::{
1516 database:: DbConnection ,
1617 json_rpc:: {
1718 server:: LegacyCode ,
18- utils:: { JsonZec , JsonZecBalance , parse_txid , value_from_zat_balance, value_from_zatoshis} ,
19+ utils:: { JsonZec , JsonZecBalance , value_from_zat_balance, value_from_zatoshis} ,
1920 } ,
2021} ;
2122
@@ -475,7 +476,7 @@ pub(crate) async fn call(
475476 verbose : Option < u64 > ,
476477 blockhash : Option < String > ,
477478) -> Response {
478- let _txid = parse_txid ( txid_str) ?;
479+ let _txid = TxId :: from_reverse_hex ( txid_str) ?;
479480 let verbose = verbose. is_some_and ( |v| v != 0 ) ;
480481
481482 // TODO: We can't support this via the current Zaino API; wait for `ChainIndex`.
@@ -572,7 +573,7 @@ pub(crate) async fn call(
572573 let ( vjoinsplit, join_split_pub_key, join_split_sig) = match tx. sprout_bundle ( ) {
573574 Some ( bundle) if !bundle. joinsplits . is_empty ( ) => (
574575 bundle. joinsplits . iter ( ) . map ( JoinSplit :: encode) . collect ( ) ,
575- Some ( TxId :: from_bytes ( bundle. joinsplit_pubkey ) . to_string ( ) ) ,
576+ Some ( ReverseHex :: decode ( bundle. joinsplit_pubkey ) ) ,
576577 Some ( hex:: encode ( bundle. joinsplit_sig ) ) ,
577578 ) ,
578579 _ => ( vec ! [ ] , None , None ) ,
@@ -614,8 +615,7 @@ pub(crate) async fn call(
614615 in_active_chain : None ,
615616 hex : tx_hex,
616617 txid : txid_str. to_ascii_lowercase ( ) ,
617- authdigest : TxId :: from_bytes ( tx. auth_commitment ( ) . as_bytes ( ) . try_into ( ) . unwrap ( ) )
618- . to_string ( ) ,
618+ authdigest : ReverseHex :: decode ( & tx. auth_commitment ( ) . as_bytes ( ) . try_into ( ) . unwrap ( ) ) ,
619619 size,
620620 overwintered,
621621 version : tx. version ( ) . header ( ) & 0x7FFFFFFF ,
@@ -709,10 +709,10 @@ impl JoinSplit {
709709impl SaplingSpend {
710710 fn encode ( spend : & SpendDescription < sapling:: bundle:: Authorized > ) -> Self {
711711 Self {
712- cv : TxId :: from_bytes ( spend. cv ( ) . to_bytes ( ) ) . to_string ( ) ,
713- anchor : TxId :: from_bytes ( spend. anchor ( ) . to_bytes ( ) ) . to_string ( ) ,
714- nullifier : TxId :: from_bytes ( spend. nullifier ( ) . 0 ) . to_string ( ) ,
715- rk : TxId :: from_bytes ( <[ u8 ; 32 ] >:: from ( * spend. rk ( ) ) ) . to_string ( ) ,
712+ cv : ReverseHex :: decode ( & spend. cv ( ) . to_bytes ( ) ) ,
713+ anchor : ReverseHex :: decode ( & spend. anchor ( ) . to_bytes ( ) ) ,
714+ nullifier : ReverseHex :: decode ( & spend. nullifier ( ) . 0 ) ,
715+ rk : ReverseHex :: decode ( & <[ u8 ; 32 ] >:: from ( * spend. rk ( ) ) ) ,
716716 proof : hex:: encode ( spend. zkproof ( ) ) ,
717717 spend_auth_sig : hex:: encode ( <[ u8 ; 64 ] >:: from ( * spend. spend_auth_sig ( ) ) ) ,
718718 }
@@ -722,9 +722,9 @@ impl SaplingSpend {
722722impl SaplingOutput {
723723 fn encode ( output : & OutputDescription < sapling:: bundle:: GrothProofBytes > ) -> Self {
724724 Self {
725- cv : TxId :: from_bytes ( output. cv ( ) . to_bytes ( ) ) . to_string ( ) ,
726- cmu : TxId :: from_bytes ( output. cmu ( ) . to_bytes ( ) ) . to_string ( ) ,
727- ephemeral_key : TxId :: from_bytes ( output. ephemeral_key ( ) . 0 ) . to_string ( ) ,
725+ cv : ReverseHex :: decode ( & output. cv ( ) . to_bytes ( ) ) ,
726+ cmu : ReverseHex :: decode ( & output. cmu ( ) . to_bytes ( ) ) ,
727+ ephemeral_key : ReverseHex :: decode ( & output. ephemeral_key ( ) . 0 ) ,
728728 enc_ciphertext : hex:: encode ( output. enc_ciphertext ( ) ) ,
729729 out_ciphertext : hex:: encode ( output. out_ciphertext ( ) ) ,
730730 proof : hex:: encode ( output. zkproof ( ) ) ,
0 commit comments