File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -576,16 +576,9 @@ impl NodeInfo {
576576 b_leaf. merkle_branch . push ( a. hash ) ?; // add hashing partner
577577 all_leaves. push ( b_leaf) ;
578578 }
579- let mut eng = TapBranchHash :: engine ( ) ;
580- if a. hash < b. hash {
581- eng. input ( & a. hash ) ;
582- eng. input ( & b. hash ) ;
583- } else {
584- eng. input ( & b. hash ) ;
585- eng. input ( & a. hash ) ;
586- } ;
579+ let hash = TapBranchHash :: from_node_hashes ( a. hash , b. hash ) ;
587580 Ok ( Self {
588- hash : sha256:: Hash :: from_engine ( eng ) ,
581+ hash : sha256:: Hash :: from_inner ( hash . into_inner ( ) ) ,
589582 leaves : all_leaves,
590583 } )
591584 }
@@ -790,16 +783,11 @@ impl ControlBlock {
790783 let mut curr_hash = TapBranchHash :: from_inner ( leaf_hash. into_inner ( ) ) ;
791784 // Verify the proof
792785 for elem in self . merkle_branch . as_inner ( ) {
793- let mut eng = TapBranchHash :: engine ( ) ;
794- if curr_hash. as_inner ( ) < elem. as_inner ( ) {
795- eng. input ( & curr_hash) ;
796- eng. input ( elem) ;
797- } else {
798- eng. input ( elem) ;
799- eng. input ( & curr_hash) ;
800- }
801786 // Recalculate the curr hash as parent hash
802- curr_hash = TapBranchHash :: from_engine ( eng) ;
787+ curr_hash = TapBranchHash :: from_node_hashes (
788+ sha256:: Hash :: from_inner ( curr_hash. into_inner ( ) ) ,
789+ * elem
790+ ) ;
803791 }
804792 // compute the taptweak
805793 let tweak = TapTweakHash :: from_key_and_tweak ( self . internal_key , Some ( curr_hash) ) ;
You can’t perform that action at this time.
0 commit comments