(cherry picked from commit 3bc7d85986
)
Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
This commit is contained in:
@ -2120,6 +2120,7 @@ fn main() {
|
|||||||
activation_epoch: Epoch,
|
activation_epoch: Epoch,
|
||||||
deactivation_epoch: Option<Epoch>,
|
deactivation_epoch: Option<Epoch>,
|
||||||
point_value: Option<PointValue>,
|
point_value: Option<PointValue>,
|
||||||
|
credits_observed: Option<u64>,
|
||||||
}
|
}
|
||||||
use solana_stake_program::stake_state::InflationPointCalculationEvent;
|
use solana_stake_program::stake_state::InflationPointCalculationEvent;
|
||||||
let mut stake_calcuration_details: HashMap<Pubkey, CalculationDetail> =
|
let mut stake_calcuration_details: HashMap<Pubkey, CalculationDetail> =
|
||||||
@ -2171,6 +2172,11 @@ fn main() {
|
|||||||
InflationPointCalculationEvent::RentExemptReserve(reserve) => {
|
InflationPointCalculationEvent::RentExemptReserve(reserve) => {
|
||||||
detail.rent_exempt_reserve = *reserve;
|
detail.rent_exempt_reserve = *reserve;
|
||||||
}
|
}
|
||||||
|
InflationPointCalculationEvent::CreditsObserved(
|
||||||
|
credits_observed,
|
||||||
|
) => {
|
||||||
|
detail.credits_observed = Some(*credits_observed);
|
||||||
|
}
|
||||||
InflationPointCalculationEvent::Delegation(
|
InflationPointCalculationEvent::Delegation(
|
||||||
delegation,
|
delegation,
|
||||||
owner,
|
owner,
|
||||||
@ -2311,6 +2317,7 @@ fn main() {
|
|||||||
deactivation_epoch: String,
|
deactivation_epoch: String,
|
||||||
earned_epochs: String,
|
earned_epochs: String,
|
||||||
earned_credits: String,
|
earned_credits: String,
|
||||||
|
credits_observed: String,
|
||||||
base_rewards: String,
|
base_rewards: String,
|
||||||
stake_rewards: String,
|
stake_rewards: String,
|
||||||
vote_rewards: String,
|
vote_rewards: String,
|
||||||
@ -2354,6 +2361,9 @@ fn main() {
|
|||||||
),
|
),
|
||||||
earned_epochs: format_or_na(detail.map(|d| d.epochs)),
|
earned_epochs: format_or_na(detail.map(|d| d.epochs)),
|
||||||
earned_credits: format_or_na(detail.map(|d| d.credits)),
|
earned_credits: format_or_na(detail.map(|d| d.credits)),
|
||||||
|
credits_observed: format_or_na(
|
||||||
|
detail.and_then(|d| d.credits_observed),
|
||||||
|
),
|
||||||
base_rewards: format_or_na(detail.map(|d| d.base_rewards)),
|
base_rewards: format_or_na(detail.map(|d| d.base_rewards)),
|
||||||
stake_rewards: format_or_na(
|
stake_rewards: format_or_na(
|
||||||
detail.map(|d| d.stake_rewards),
|
detail.map(|d| d.stake_rewards),
|
||||||
|
@ -38,6 +38,7 @@ pub enum InflationPointCalculationEvent {
|
|||||||
RentExemptReserve(u64),
|
RentExemptReserve(u64),
|
||||||
Delegation(Delegation, Pubkey),
|
Delegation(Delegation, Pubkey),
|
||||||
Commission(u8),
|
Commission(u8),
|
||||||
|
CreditsObserved(u64),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn null_tracer() -> Option<impl FnMut(&InflationPointCalculationEvent)> {
|
fn null_tracer() -> Option<impl FnMut(&InflationPointCalculationEvent)> {
|
||||||
@ -519,6 +520,11 @@ impl Stake {
|
|||||||
)
|
)
|
||||||
.map(|(stakers_reward, voters_reward, credits_observed)| {
|
.map(|(stakers_reward, voters_reward, credits_observed)| {
|
||||||
self.credits_observed = 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;
|
self.delegation.stake += stakers_reward;
|
||||||
(stakers_reward, voters_reward)
|
(stakers_reward, voters_reward)
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user