@@ -24,7 +24,7 @@ use ic_nervous_system_common::ONE_DAY_SECONDS;
24
24
use ic_nns_common:: pb:: v1:: { NeuronId , ProposalId } ;
25
25
use ic_nns_governance_api:: pb:: v1:: { self as api, NeuronInfo } ;
26
26
use icp_ledger:: Subaccount ;
27
- use rust_decimal:: Decimal ;
27
+ use rust_decimal:: { Decimal , RoundingStrategy } ;
28
28
use std:: {
29
29
collections:: { BTreeSet , HashMap } ,
30
30
time:: Duration ,
@@ -294,7 +294,7 @@ impl Neuron {
294
294
> 0
295
295
}
296
296
297
- /// How much swap this neuron has when it casts its vote on proposals.
297
+ /// How much sway this neuron has when it casts its vote on proposals.
298
298
pub fn deciding_voting_power (
299
299
& self ,
300
300
voting_power_economics : & VotingPowerEconomics ,
@@ -318,8 +318,10 @@ impl Neuron {
318
318
// Main calculation.
319
319
let result = adjustment_factor * Decimal :: from ( potential_voting_power) ;
320
320
321
- // Convert (back) to u64.
322
- let result = result. round ( ) ;
321
+ // Convert (back) to u64. The particular type of rounding used here does
322
+ // not matter to us very much, because we are not for example
323
+ // apportioning (where rounding down is best), nor anything like that.
324
+ let result = result. round_dp_with_strategy ( 0 , RoundingStrategy :: MidpointNearestEven ) ;
323
325
u64:: try_from ( result) . unwrap_or_else ( |err| {
324
326
// Log and fall back to potential voting power. Assuming
325
327
// adjustment_factor is in [0, 1], I see no way this can happen.
0 commit comments