Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MPoW] Fix updating stake limit on reporting works #140

Merged
merged 7 commits into from
May 22, 2020
15 changes: 9 additions & 6 deletions cstrml/tee/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,16 @@ impl<T: Trait> Module<T> {

Used::put(total_used);
Reserved::put(total_reserved);
let total_workload = total_used + total_reserved;

// 5. Call `on_report_works` handler
T::Works::report_works(
&who,
used + reserved,
total_used + total_reserved,
);
// 5. Update work report for every identity
for (controller, wr) in <WorkReports<T>>::iter() {
T::Works::report_works(
&controller,
badkk marked this conversation as resolved.
Show resolved Hide resolved
(wr.used + wr.reserved) as u128,
total_workload
);
}
true
}

Expand Down