ledger-tool cap: output credits_observed (#13746) (#13747)

(cherry picked from commit 3bc7d85986)

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
This commit is contained in:
mergify[bot]
2020-11-21 17:31:03 +00:00
committed by GitHub
parent fd39a09eae
commit de03a5092d
2 changed files with 16 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ pub enum InflationPointCalculationEvent {
RentExemptReserve(u64),
Delegation(Delegation, Pubkey),
Commission(u8),
CreditsObserved(u64),
}
fn null_tracer() -> Option<impl FnMut(&InflationPointCalculationEvent)> {
@@ -479,6 +480,11 @@ impl Stake {
)
.map(|(stakers_reward, voters_reward, credits_observed)| {
self.credits_observed = credits_observed;
if let Some(inflation_point_calc_tracer) = inflation_point_calc_tracer {
inflation_point_calc_tracer(&InflationPointCalculationEvent::CreditsObserved(
credits_observed,
));
}
self.delegation.stake += stakers_reward;
(stakers_reward, voters_reward)
})