File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,8 @@ impl StakeWeightedRoundState {
118118 }
119119 let approve_stake = self . approve_stake ( ) ;
120120 // Require strictly more than 50% to prevent ties
121- approve_stake * 2 > total_stake
121+ // Use division instead of multiplication to avoid overflow with large stake values
122+ approve_stake > total_stake / 2
122123 }
123124
124125 /// Check if rejection is certain (>50% reject stake)
@@ -127,7 +128,8 @@ impl StakeWeightedRoundState {
127128 return false ;
128129 }
129130 let reject_stake = self . reject_stake ( ) ;
130- reject_stake * 2 > total_stake
131+ // Use division instead of multiplication to avoid overflow with large stake values
132+ reject_stake > total_stake / 2
131133 }
132134
133135 /// Get vote count (for logging)
You can’t perform that action at this time.
0 commit comments