From 52ff11aa257edf57784b32cc3dcd22812b71e3fa Mon Sep 17 00:00:00 2001 From: Jude Nelson Date: Tue, 27 Apr 2021 00:46:55 -0400 Subject: [PATCH] add get_stacks_epoch() to BurnStateDB --- src/clarity_vm/database/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/clarity_vm/database/mod.rs b/src/clarity_vm/database/mod.rs index bb7b39035..d1da1fc25 100644 --- a/src/clarity_vm/database/mod.rs +++ b/src/clarity_vm/database/mod.rs @@ -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 { + 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 { + SortitionDB::get_stacks_epoch(self.conn(), height as u64) + .expect("BUG: failed to get epoch for burn block height") + } } pub struct MemoryBackingStore {