fix: make Txid serialize to text, and make the chain-liveness thread sleep for 1 second in-between wake-ups

This commit is contained in:
Jude Nelson
2022-12-23 15:03:04 -05:00
parent 2c7917e6d5
commit 5fb047efda
2 changed files with 9 additions and 3 deletions

View File

@@ -69,12 +69,12 @@ pub mod indexer;
#[cfg(test)]
pub mod tests;
#[derive(Serialize, Deserialize)]
pub struct Txid(pub [u8; 32]);
impl_array_newtype!(Txid, u8, 32);
impl_array_hexstring_fmt!(Txid);
impl_byte_array_newtype!(Txid, u8, 32);
impl_byte_array_message_codec!(Txid, 32);
impl_byte_array_serde!(Txid);
pub const TXID_ENCODED_SIZE: u32 = 32;
pub const MAGIC_BYTES_LENGTH: usize = 2;

View File

@@ -46,6 +46,7 @@ use crate::{
};
use stacks::chainstate::stacks::miner::{signal_mining_blocked, signal_mining_ready, MinerStatus};
use stacks_common::util::get_epoch_time_secs;
use stacks_common::util::sleep_ms;
use libc;
use stacks::util::hash::Hash160;
@@ -757,9 +758,10 @@ impl RunLoop {
if canonical_burnchain_tip.block_height > highest_sn.block_height {
// still processing sortitions
debug!(
test_debug!(
"Drive burn block processing: still processing sortitions ({} > {})",
canonical_burnchain_tip.block_height, highest_sn.block_height
canonical_burnchain_tip.block_height,
highest_sn.block_height
);
return;
}
@@ -859,7 +861,11 @@ impl RunLoop {
&sortdb,
&mut last_stacks_pox_reorg_recover_time,
);
sleep_ms(1000);
}
debug!("Chain-liveness thread exit!");
}
/// Spawn a thread to drive chain liveness