added missing function

This commit is contained in:
Pavitthra Pandurangan
2023-05-31 17:10:37 -04:00
parent 1b371c2a30
commit d467434d7e
2 changed files with 21 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ use rand::RngCore;
use rusqlite::Connection;
use rusqlite::DatabaseName;
use rusqlite::{Error as sqlite_error, OptionalExtension};
use serde::Serialize;
use crate::burnchains::affirmation::AffirmationMap;
use crate::burnchains::db::BurnchainDB;

View File

@@ -217,7 +217,7 @@ use super::{BurnchainController, Config, EventDispatcher, Keychain};
use crate::syncctl::PoxSyncWatchdogComms;
use stacks::monitoring;
use stacks_common::types::chainstate::StacksBlockId;
use stacks_common::types::chainstate::{StacksBlockId, StacksPrivateKey};
use stacks_common::util::vrf::VRFProof;
use clarity::vm::ast::ASTRules;
@@ -3821,6 +3821,25 @@ impl PeerThread {
}
impl StacksNode {
/// Create a StacksPrivateKey from a given seed buffer
pub fn make_node_private_key_from_seed(seed: &[u8]) -> StacksPrivateKey {
let node_privkey = {
let mut re_hashed_seed = seed.to_vec();
let my_private_key = loop {
match Secp256k1PrivateKey::from_slice(&re_hashed_seed[..]) {
Ok(sk) => break sk,
Err(_) => {
re_hashed_seed = Sha256Sum::from_data(&re_hashed_seed[..])
.as_bytes()
.to_vec()
}
}
};
my_private_key
};
node_privkey
}
/// Set up the AST size-precheck height, if configured
fn setup_ast_size_precheck(config: &Config, sortdb: &mut SortitionDB) {
if let Some(ast_precheck_size_height) = config.burnchain.ast_precheck_size_height {