Moved keys submodules

This commit is contained in:
Dave Hrycyszyn
2024-06-20 17:13:34 +01:00
parent 1ad7c99283
commit a29a0fca04
6 changed files with 10 additions and 11 deletions

View File

@@ -2,7 +2,7 @@ use std::path::PathBuf;
use config::SideNodeConfig; use config::SideNodeConfig;
use crate::{bft_crdt_keys, bitcoin_keys, utils}; use crate::{keys, utils};
pub(crate) mod config; pub(crate) mod config;
@@ -11,10 +11,10 @@ pub(crate) fn init(home: PathBuf, config: SideNodeConfig) -> Result<(), std::io:
let (bft_crdt_key_path, bitcoin_key_path, config_path) = utils::side_paths(home.clone()); let (bft_crdt_key_path, bitcoin_key_path, config_path) = utils::side_paths(home.clone());
println!("Writing bft crdt key to: {:?}", bft_crdt_key_path); println!("Writing bft crdt key to: {:?}", bft_crdt_key_path);
bft_crdt_keys::write(&bft_crdt_key_path)?; keys::bft_crdt::write(&bft_crdt_key_path)?;
println!("Writing bitcoin key to: {:?}", bitcoin_key_path); println!("Writing bitcoin key to: {:?}", bitcoin_key_path);
bitcoin_keys::write(&bitcoin_key_path)?; keys::bitcoin::write(&bitcoin_key_path)?;
println!("Writing config to: {:?}", config_path); println!("Writing config to: {:?}", config_path);
config::write_toml(&config, &config_path).expect("unable to write config file"); config::write_toml(&config, &config_path).expect("unable to write config file");

View File

@@ -0,0 +1,2 @@
pub mod bft_crdt;
pub mod bitcoin;

View File

@@ -5,11 +5,10 @@ use node::SideNode;
use tokio::{sync::mpsc, task}; use tokio::{sync::mpsc, task};
use websocket::WebSocketClient; use websocket::WebSocketClient;
pub mod bft_crdt_keys;
pub mod bitcoin_keys;
pub(crate) mod cli; pub(crate) mod cli;
pub mod crdt; pub mod crdt;
pub(crate) mod init; pub(crate) mod init;
pub mod keys;
pub mod node; pub mod node;
pub(crate) mod stdin; pub(crate) mod stdin;
pub mod utils; pub mod utils;
@@ -39,8 +38,8 @@ pub async fn run() {
async fn setup(name: &String) -> SideNode { async fn setup(name: &String) -> SideNode {
// First, load up the keys and create a bft-crdt // First, load up the keys and create a bft-crdt
let side_dir = utils::home(name); let side_dir = utils::home(name);
let bft_crdt_keys = bft_crdt_keys::load_from_file(&side_dir); let bft_crdt_keys = keys::bft_crdt::load_from_file(&side_dir);
let bitcoin_keys = bitcoin_keys::load_from_file(&side_dir); let bitcoin_keys = keys::bitcoin::load_from_file(&side_dir);
let crdt = BaseCrdt::<TransactionList>::new(&bft_crdt_keys); let crdt = BaseCrdt::<TransactionList>::new(&bft_crdt_keys);
// Channels for internal communication, and a tokio task for stdin input // Channels for internal communication, and a tokio task for stdin input

View File

@@ -2,9 +2,7 @@ use bft_json_crdt::{
json_crdt::{BaseCrdt, SignedOp}, json_crdt::{BaseCrdt, SignedOp},
keypair::make_keypair, keypair::make_keypair,
}; };
use side_node::{ use side_node::{crdt::TransactionList, keys, node::SideNode, utils, websocket::WebSocketClient};
bitcoin_keys, crdt::TransactionList, node::SideNode, utils, websocket::WebSocketClient,
};
use tokio::sync::mpsc; use tokio::sync::mpsc;
#[tokio::test] #[tokio::test]
@@ -37,7 +35,7 @@ async fn test_distribute_via_websockets() {
async fn setup(_: &str) -> SideNode { async fn setup(_: &str) -> SideNode {
// First, load up the keys and create a bft-crdt // First, load up the keys and create a bft-crdt
let bft_crdt_keys = make_keypair(); let bft_crdt_keys = make_keypair();
let bitcoin_keys = bitcoin_keys::make_keypair(); let bitcoin_keys = keys::bitcoin::make_keypair();
let crdt = BaseCrdt::<TransactionList>::new(&bft_crdt_keys); let crdt = BaseCrdt::<TransactionList>::new(&bft_crdt_keys);
// Channels for internal communication, and a tokio task for stdin input // Channels for internal communication, and a tokio task for stdin input