forked from coal-digital/coal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bus.rs
33 lines (25 loc) · 1012 Bytes
/
bus.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use bytemuck::{Pod, Zeroable};
use crate::utils::{impl_account_from_bytes, impl_to_bytes, Discriminator};
use super::AccountDiscriminator;
/// Bus accounts are responsible for distributing mining rewards. There are 8 busses total
/// to minimize write-lock contention and allow Solana to process mine instructions in parallel.
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Bus {
/// The ID of the bus account.
pub id: u64,
/// The remaining rewards this bus has left to payout in the current epoch.
pub rewards: u64,
/// The rewards this bus would have paid out in the current epoch if there no limit.
/// This is used to calculate the updated reward rate.
pub theoretical_rewards: u64,
/// The largest known stake balance seen by the bus this epoch.
pub top_balance: u64,
}
impl Discriminator for Bus {
fn discriminator() -> u8 {
AccountDiscriminator::Bus.into()
}
}
impl_to_bytes!(Bus);
impl_account_from_bytes!(Bus);