epoch rewards are stored partitioned as Vec<Vec< (#32076)
* epoch rewards are stored partitioned as Vec<Vec< * update comment
This commit is contained in:
parent
7e7c286d50
commit
6280c63e1a
|
@ -882,8 +882,8 @@ impl AbiExample for OptionalDropCallback {
|
||||||
pub(crate) struct StartBlockHeightAndRewards {
|
pub(crate) struct StartBlockHeightAndRewards {
|
||||||
/// the block height of the slot at which rewards distribution began
|
/// the block height of the slot at which rewards distribution began
|
||||||
pub(crate) start_block_height: u64,
|
pub(crate) start_block_height: u64,
|
||||||
/// calculated epoch rewards pending distribution
|
/// calculated epoch rewards pending distribution, outer Vec is by partition (one partition per block)
|
||||||
pub(crate) calculated_epoch_stake_rewards: Arc<StakeRewards>,
|
pub(crate) calculated_epoch_stake_rewards: Arc<Vec<StakeRewards>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represent whether bank is in the reward phase or not.
|
/// Represent whether bank is in the reward phase or not.
|
||||||
|
@ -1446,7 +1446,7 @@ impl Bank {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub(crate) fn set_epoch_reward_status_active(&mut self, stake_rewards: StakeRewards) {
|
pub(crate) fn set_epoch_reward_status_active(&mut self, stake_rewards: Vec<StakeRewards>) {
|
||||||
self.epoch_reward_status = EpochRewardStatus::Active(StartBlockHeightAndRewards {
|
self.epoch_reward_status = EpochRewardStatus::Active(StartBlockHeightAndRewards {
|
||||||
start_block_height: self.block_height,
|
start_block_height: self.block_height,
|
||||||
calculated_epoch_stake_rewards: Arc::new(stake_rewards),
|
calculated_epoch_stake_rewards: Arc::new(stake_rewards),
|
||||||
|
|
|
@ -513,7 +513,7 @@ fn test_extra_fields_eof() {
|
||||||
let sample_rewards = (0..2)
|
let sample_rewards = (0..2)
|
||||||
.map(|_| StakeReward::new_random())
|
.map(|_| StakeReward::new_random())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
for epoch_reward_status_active in [None, Some(vec![]), Some(sample_rewards)] {
|
for epoch_reward_status_active in [None, Some(vec![]), Some(vec![sample_rewards])] {
|
||||||
let (genesis_config, _) = create_genesis_config(500);
|
let (genesis_config, _) = create_genesis_config(500);
|
||||||
|
|
||||||
let bank0 = Arc::new(Bank::new_for_tests_with_config(
|
let bank0 = Arc::new(Bank::new_for_tests_with_config(
|
||||||
|
@ -618,7 +618,7 @@ fn test_extra_fields_full_snapshot_archive() {
|
||||||
let sample_rewards = (0..2)
|
let sample_rewards = (0..2)
|
||||||
.map(|_| StakeReward::new_random())
|
.map(|_| StakeReward::new_random())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
for epoch_reward_status_active in [None, Some(vec![]), Some(sample_rewards)] {
|
for epoch_reward_status_active in [None, Some(vec![]), Some(vec![sample_rewards])] {
|
||||||
let (mut genesis_config, _) = create_genesis_config(500);
|
let (mut genesis_config, _) = create_genesis_config(500);
|
||||||
activate_all_features(&mut genesis_config);
|
activate_all_features(&mut genesis_config);
|
||||||
|
|
||||||
|
@ -786,7 +786,7 @@ mod test_bank_serialize {
|
||||||
|
|
||||||
// This some what long test harness is required to freeze the ABI of
|
// This some what long test harness is required to freeze the ABI of
|
||||||
// Bank's serialization due to versioned nature
|
// Bank's serialization due to versioned nature
|
||||||
#[frozen_abi(digest = "8LhKH71kTwmagxUGJA6Es58p8fejJsSAdgEmtL3xZdoY")]
|
#[frozen_abi(digest = "E783LfT75MPc1A9bqVtq3HsSkv3MP8kbssyJVYHA3erG")]
|
||||||
#[derive(Serialize, AbiExample)]
|
#[derive(Serialize, AbiExample)]
|
||||||
pub struct BankAbiTestWrapperNewer {
|
pub struct BankAbiTestWrapperNewer {
|
||||||
#[serde(serialize_with = "wrapper_newer")]
|
#[serde(serialize_with = "wrapper_newer")]
|
||||||
|
|
Loading…
Reference in New Issue