@@ -170,21 +170,20 @@ void database::pay_workers( share_type& budget )
170
170
171
171
const auto last_budget_time = get_dynamic_global_properties ().last_budget_time ;
172
172
const auto passed_time_ms = head_time - last_budget_time;
173
- const bool passed_time_is_a_day = ( passed_time_ms == fc::days (1 ) );
174
- // the variable above is more likely false on BitShares mainnet, so do calculations below anyway
175
173
const auto passed_time_count = passed_time_ms.count ();
176
174
const auto day_count = fc::days (1 ).count ();
177
175
for ( uint32_t i = 0 ; i < active_workers.size () && budget > 0 ; ++i )
178
176
{
179
177
const worker_object& active_worker = active_workers[i];
180
178
share_type requested_pay = active_worker.daily_pay ;
181
- if ( !passed_time_is_a_day )
182
- {
183
- fc::uint128 pay (requested_pay.value );
184
- pay *= passed_time_count;
185
- pay /= day_count;
186
- requested_pay = pay.to_uint64 ();
187
- }
179
+
180
+ // Note: if there is a good chance that passed_time_count == day_count,
181
+ // for better performance, can avoid the 128 bit calculation by adding a check.
182
+ // Since it's not the case on BitShares mainnet, we're not using a check here.
183
+ fc::uint128 pay (requested_pay.value );
184
+ pay *= passed_time_count;
185
+ pay /= day_count;
186
+ requested_pay = pay.to_uint64 ();
188
187
189
188
share_type actual_pay = std::min (budget, requested_pay);
190
189
// ilog(" ==> Paying ${a} to worker ${w}", ("w", active_worker.id)("a", actual_pay));
0 commit comments