@@ -123,6 +123,26 @@ impl<
123123> DagknightExecutor < C , O , D , E , R >
124124{
125125 pub fn dagknight ( & self , parents : & [ Hash ] ) -> DagknightData {
126+ let pure_result = self . dagknight_pure ( parents, false ) ;
127+ let shortcut_result = self . dagknight_pure ( parents, true ) ;
128+
129+ assert_eq ! (
130+ shortcut_result. selected_parent, pure_result. selected_parent,
131+ "Shortcut result and pure result should have the same selected parent | shortcut: {} | pure: {} | parents: {:?}" ,
132+ shortcut_result. selected_parent, pure_result. selected_parent, parents
133+ ) ;
134+ assert_eq ! (
135+ BlockHashSet :: from_iter( shortcut_result. conflict_ordered_parents. clone( ) ) ,
136+ BlockHashSet :: from_iter( pure_result. conflict_ordered_parents. clone( ) ) ,
137+ "Shortcut result and pure result should have the same conflict-ordered parents | shortcut: {:?} | pure: {:?} | parents: {:?}" ,
138+ shortcut_result. conflict_ordered_parents,
139+ pure_result. conflict_ordered_parents,
140+ parents
141+ ) ;
142+ shortcut_result
143+ }
144+
145+ pub fn dagknight_pure ( & self , parents : & [ Hash ] , use_shortcut : bool ) -> DagknightData {
126146 /*
127147 input: a set of block parents
128148 output: the selected parent + incremental metadata
@@ -176,8 +196,6 @@ impl<
176196 continue ;
177197 }
178198
179- let use_shortcut = false ;
180-
181199 // Check shortcut to identify weak groups at k=0
182200 // This doesn't change conflict hierarchy - it just marks groups as weak
183201 // for later processes to decide what to do with such weak groups
0 commit comments