File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
rs/nns/governance/src/neuron_store Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -111,19 +111,23 @@ impl NeuronMetrics {
111
111
now_seconds : u64 ,
112
112
neuron : & Neuron ,
113
113
) {
114
+ // The substraction here assumes that the neuron was not refreshed in
115
+ // the future. (This doesn't always hold in tests though, due to the
116
+ // difficulty of constructing realistic data/scenarios.)
114
117
let seconds_since_voting_power_refreshed =
115
- // Here, we assume that the neuron was not refreshed in the future.
116
- // This doesn't always hold in tests though, due to the difficulty
117
- // of constructing realistic data/scenarios.
118
118
now_seconds. saturating_sub ( neuron. voting_power_refreshed_timestamp_seconds ( ) ) ;
119
- let Some ( seconds_losing_voting_power) = seconds_since_voting_power_refreshed
120
- . checked_sub ( voting_power_economics. get_start_reducing_voting_power_after_seconds ( ) )
121
- else {
119
+
120
+ let is_recently_refreshed = seconds_since_voting_power_refreshed
121
+ < voting_power_economics. get_start_reducing_voting_power_after_seconds ( ) ;
122
+ if is_recently_refreshed {
122
123
return ;
123
- } ;
124
+ }
124
125
125
- if seconds_losing_voting_power < voting_power_economics. get_clear_following_after_seconds ( )
126
- {
126
+ let is_moderately_refreshed = seconds_since_voting_power_refreshed
127
+ < voting_power_economics
128
+ . get_start_reducing_voting_power_after_seconds ( )
129
+ . saturating_add ( voting_power_economics. get_clear_following_after_seconds ( ) ) ;
130
+ if is_moderately_refreshed {
127
131
self . declining_voting_power_neuron_subset_metrics . increment (
128
132
voting_power_economics,
129
133
now_seconds,
You can’t perform that action at this time.
0 commit comments