@@ -9,23 +9,23 @@ pub enum LongerChainResult {
99}
1010
1111pub fn select_longer_chain (
12- tip : & MinaStateProtocolStateValueStableV2 ,
1312 candidate : & MinaStateProtocolStateValueStableV2 ,
13+ tip : & MinaStateProtocolStateValueStableV2 ,
1414) -> LongerChainResult {
15- let tip_block_height = & tip. body . consensus_state . blockchain_length . as_u32 ( ) ;
1615 let candidate_block_height = & candidate. body . consensus_state . blockchain_length . as_u32 ( ) ;
16+ let tip_block_height = & tip. body . consensus_state . blockchain_length . as_u32 ( ) ;
1717
18- if tip_block_height < candidate_block_height {
18+ if candidate_block_height > tip_block_height {
1919 return LongerChainResult :: Candidate ;
2020 }
2121 // tiebreak logic
22- else if tip_block_height == candidate_block_height {
22+ else if candidate_block_height == tip_block_height {
2323 // compare last VRF digests lexicographically
24- if hash_last_vrf ( tip ) < hash_last_vrf ( candidate ) {
24+ if hash_last_vrf ( candidate ) > hash_last_vrf ( tip ) {
2525 return LongerChainResult :: Candidate ;
26- } else if hash_last_vrf ( tip ) == hash_last_vrf ( candidate ) {
26+ } else if hash_last_vrf ( candidate ) == hash_last_vrf ( tip ) {
2727 // compare consensus state hashes lexicographically
28- if hash_state ( tip ) < hash_state ( candidate ) {
28+ if hash_state ( candidate ) > hash_state ( tip ) {
2929 return LongerChainResult :: Candidate ;
3030 }
3131 }
0 commit comments