Starting a refactor into more functional modules
This commit is contained in:
@@ -5,6 +5,7 @@ use crdt::TransactionList;
|
||||
use node::SideNode;
|
||||
use tokio::{sync::mpsc, task};
|
||||
|
||||
pub(crate) mod bitcoin;
|
||||
pub(crate) mod cli;
|
||||
pub mod clients;
|
||||
pub mod crdt;
|
||||
@@ -31,19 +32,19 @@ pub async fn run() {
|
||||
node.start().await;
|
||||
}
|
||||
Some(Commands::Btc {}) => {
|
||||
let _ = clients::btc_esplora_client::run().await;
|
||||
let _ = bitcoin::clients::btc_esplora_client::run().await;
|
||||
}
|
||||
None => println!("No command provided. Exiting. See --help for more information."),
|
||||
}
|
||||
}
|
||||
|
||||
/// Wire everything up outside the application so we can test more easily later
|
||||
/// Wire everything up outside the application so that we can test more easily later
|
||||
async fn setup(name: &String) -> SideNode {
|
||||
// First, load up the keys and create a bft-crdt
|
||||
let side_dir = utils::home(name);
|
||||
let bft_crdt_keys = keys::bft_crdt::load_from_file(&side_dir);
|
||||
let bitcoin_keys = keys::bitcoin::load_from_file(&side_dir).unwrap();
|
||||
let bitcoin_wallet = clients::btc_electrum_client::create_wallet(bitcoin_keys).unwrap();
|
||||
let bitcoin_keys = bitcoin::bitcoin_keys::load_from_file(&side_dir).unwrap();
|
||||
let bitcoin_wallet = bitcoin::clients::btc_electrum_client::create_wallet(bitcoin_keys).unwrap();
|
||||
let crdt = BaseCrdt::<TransactionList>::new(&bft_crdt_keys);
|
||||
|
||||
// Channels for internal communication, and a tokio task for stdin input
|
||||
|
||||
Reference in New Issue
Block a user