Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jcnelson committed Jan 5, 2021
1 parent bfc3edc commit 1d977c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/vm/clarity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,8 @@ impl ClarityInstance {
header_db: &'a dyn HeadersDB,
burn_state_db: &'a dyn BurnStateDB,
) -> ClarityReadOnlyConnection<'a> {
let datastore = self.datastore.begin_read_only(Some(at_block));

ClarityReadOnlyConnection {
datastore,
header_db,
burn_state_db,
}
self.read_only_connection_checked(at_block, header_db, burn_state_db)
.expect(&format!("BUG: failed to open block {}", at_block))
}

pub fn read_only_connection_checked<'a>(
Expand Down
7 changes: 7 additions & 0 deletions testnet/stacks-node/src/neon_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ fn spawn_miner_relayer(
let mut bitcoin_controller = BitcoinRegtestController::new_dummy(config.clone());
let mut microblock_miner_state = None;
let mut miner_tip = None;
let mut last_microblock_tenure_time = 0;

let _relayer_handle = thread::Builder::new().name("relayer".to_string()).spawn(move || {
let mut did_register_key = false;
Expand Down Expand Up @@ -929,6 +930,12 @@ fn spawn_miner_relayer(
bump_processed_counter(&blocks_processed);
}
RelayerDirective::RunMicroblockTenure => {
if last_microblock_tenure_time + (config.node.microblock_frequency as u128) > get_epoch_time_ms() {
// only mine when necessary -- the deadline to begin hasn't passed yet
continue;
}
last_microblock_tenure_time = get_epoch_time_ms();

debug!("Relayer: run microblock tenure");

// unconfirmed state must be consistent with the chain tip
Expand Down

0 comments on commit 1d977c1

Please sign in to comment.