add get_stacks_epoch() to BurnStateDB

This commit is contained in:
Jude Nelson
2021-04-27 00:46:55 -04:00
parent e4ee440197
commit 52ff11aa25

View File

@@ -18,6 +18,8 @@ use crate::types::chainstate::{BlockHeaderHash, BurnchainHeaderHash, SortitionId
use crate::types::chainstate::{StacksAddress, VRFSeed};
use crate::types::proof::{ClarityMarfTrieId, TrieMerkleProof};
use core::StacksEpoch;
pub mod marf;
impl HeadersDB for DBConn {
@@ -97,6 +99,11 @@ impl BurnStateDB for SortitionHandleTx<'_> {
_ => return None,
}
}
fn get_stacks_epoch(&self, height: u32) -> Option<StacksEpoch> {
SortitionDB::get_stacks_epoch(self.tx(), height as u64)
.expect("BUG: failed to get epoch for burn block height")
}
}
impl BurnStateDB for SortitionDBConn<'_> {
@@ -118,6 +125,11 @@ impl BurnStateDB for SortitionDBConn<'_> {
_ => return None,
}
}
fn get_stacks_epoch(&self, height: u32) -> Option<StacksEpoch> {
SortitionDB::get_stacks_epoch(self.conn(), height as u64)
.expect("BUG: failed to get epoch for burn block height")
}
}
pub struct MemoryBackingStore {