use EpochID check for disabling, add (missing) test file

This commit is contained in:
Aaron Blankstein
2023-04-21 13:40:43 -05:00
parent 730028e3f6
commit 37cce8b53c
2 changed files with 1091 additions and 5 deletions

View File

@@ -265,7 +265,10 @@ impl RewardSetProvider for OnChainRewardSetProvider {
sortdb: &SortitionDB,
block_id: &StacksBlockId,
) -> Result<RewardSet, Error> {
if current_burn_height > burnchain.pox_constants.v2_unlock_height as u64 {
let cur_epoch = SortitionDB::get_stacks_epoch(sortdb.conn(), current_burn_height)?.expect(
&format!("FATAL: no epoch for burn height {}", current_burn_height),
);
if cur_epoch.epoch_id >= StacksEpochId::Epoch22 {
info!("PoX reward cycle defaulting to burn in Epoch 2.2");
return Ok(RewardSet::empty());
}
@@ -300,10 +303,6 @@ impl RewardSetProvider for OnChainRewardSetProvider {
"registered_addrs" => registered_addrs.len());
}
let cur_epoch = SortitionDB::get_stacks_epoch(sortdb.conn(), current_burn_height)?.expect(
&format!("FATAL: no epoch for burn height {}", current_burn_height),
);
Ok(StacksChainState::make_reward_set(
threshold,
registered_addrs,

File diff suppressed because it is too large Load Diff