-
Notifications
You must be signed in to change notification settings - Fork 714
Support abritrary epochs in TestChainstate #6619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 7 commits
1eb48de
59c48ea
0d2e5fa
9f8c670
ed30abc
eafad79
3650058
7500516
13659d1
d7c728a
84306cd
c37946e
76edefd
74e94fc
14e13e2
0e71860
6069c36
0a44f6c
779315b
a7c544d
3ea9d35
381398d
e4e5ab6
7fec308
6da8514
70727c6
b299a8c
52fc4c4
1ff2cd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -363,28 +363,27 @@ pub fn load_nakamoto_reward_set<U: RewardSetProvider>( | |
| provider: &U, | ||
| ) -> Result<Option<(RewardCycleInfo, StacksHeaderInfo)>, Error> { | ||
| let cycle_start_height = burnchain.nakamoto_first_block_of_cycle(reward_cycle); | ||
|
|
||
| let epoch_at_height = SortitionDB::get_stacks_epoch(sort_db.conn(), cycle_start_height)? | ||
| .unwrap_or_else(|| { | ||
| panic!( | ||
| "FATAL: no epoch defined for burn height {}", | ||
| cycle_start_height | ||
| ) | ||
| }); | ||
|
|
||
| // Find the first Stacks block in this reward cycle's preceding prepare phase. | ||
| // This block will have invoked `.signers.stackerdb-set-signer-slots()` with the reward set. | ||
| // Note that we may not have processed it yet. But, if we do find it, then it's | ||
| // unique (and since Nakamoto Stacks blocks are processed in order, the anchor block | ||
| // cannot change later). | ||
| let first_epoch30_reward_cycle = burnchain | ||
| .block_height_to_reward_cycle(epoch_at_height.start_height) | ||
| .expect("FATAL: no reward cycle for epoch 3.0 start height"); | ||
|
|
||
| if !epoch_at_height | ||
| .epoch_id | ||
| .uses_nakamoto_reward_set(reward_cycle, first_epoch30_reward_cycle) | ||
| { | ||
| .unwrap_or_else(|| panic!("FATAL: no epoch defined for burn height {cycle_start_height}")); | ||
| let is_pre_naka_epoch = if epoch_at_height.epoch_id < StacksEpochId::Epoch30 { | ||
| true | ||
| } else { | ||
| let epoch_30 = | ||
| SortitionDB::get_stacks_epoch_by_epoch_id(sort_db.conn(), &StacksEpochId::Epoch30)? | ||
| .unwrap_or_else(|| panic!("FATAL: no Nakamoto epoch defined")); | ||
| // Find the first Stacks block in this reward cycle's preceding prepare phase. | ||
| // This block will have invoked `.signers.stackerdb-set-signer-slots()` with the reward set. | ||
| // Note that we may not have processed it yet. But, if we do find it, then it's | ||
| // unique (and since Nakamoto Stacks blocks are processed in order, the anchor block | ||
| // cannot change later). | ||
| let first_epoch30_reward_cycle = burnchain | ||
| .block_height_to_reward_cycle(epoch_30.start_height) | ||
| .expect("FATAL: no reward cycle for epoch 3.0 start height"); | ||
| !epoch_at_height | ||
| .epoch_id | ||
| .uses_nakamoto_reward_set(reward_cycle, first_epoch30_reward_cycle) | ||
| }; | ||
| if is_pre_naka_epoch { | ||
|
||
| // in epoch 2.5, and in the first reward cycle of epoch 3.0, the reward set can *only* be found in the sortition DB. | ||
| // The nakamoto chain-processing rules aren't active yet, so we can't look for the reward | ||
| // cycle info in the nakamoto chain state. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.