mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-06-17 02:24:48 +08:00
feat: add get_stacks_epochs() trait implementation
This commit is contained in:
@@ -42,6 +42,7 @@ use stacks::chainstate::burn::operations::{
|
||||
};
|
||||
use stacks::chainstate::coordinator::comm::CoordinatorChannels;
|
||||
use stacks::codec::StacksMessageCodec;
|
||||
use stacks::core::StacksEpoch;
|
||||
use stacks::deps::bitcoin::blockdata::opcodes;
|
||||
use stacks::deps::bitcoin::blockdata::script::{Builder, Script};
|
||||
use stacks::deps::bitcoin::blockdata::transaction::{OutPoint, Transaction, TxIn, TxOut};
|
||||
@@ -320,7 +321,7 @@ impl BitcoinRegtestController {
|
||||
}
|
||||
}
|
||||
|
||||
fn setup_indexer_runtime(&mut self) -> (Burnchain, BitcoinIndexer) {
|
||||
fn setup_indexer_runtime(&self) -> (Burnchain, BitcoinIndexer) {
|
||||
let (_, network_type) = self.config.burnchain.get_bitcoin_network();
|
||||
let indexer_runtime = BitcoinIndexerRuntime::new(network_type);
|
||||
let burnchain_indexer = BitcoinIndexer {
|
||||
@@ -1480,6 +1481,16 @@ impl BurnchainController for BitcoinRegtestController {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_stacks_epochs(&self) -> Vec<StacksEpoch> {
|
||||
match self.config.burnchain.epochs.as_ref() {
|
||||
Some(epochs) => epochs.clone(),
|
||||
None => {
|
||||
let (_, indexer) = self.setup_indexer_runtime();
|
||||
indexer.get_stacks_epochs()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn start(
|
||||
&mut self,
|
||||
target_block_height_opt: Option<u64>,
|
||||
|
||||
Reference in New Issue
Block a user