Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 181 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ futures = { version = "0.3.30", default-features = false }
governor = { version = "0.8.1", default-features = false }
hashlink = "0.12.1"
heed = "0.22.0"
hickory-resolver = { version = "0.26", default-features = false }
http = "1.2.0"
human-size = "0.4.3"
jsonrpsee = { version = "0.26.0", features = ["tracing"] }
Expand Down
29 changes: 23 additions & 6 deletions app/app.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
use std::{borrow::BorrowMut, collections::HashMap, sync::Arc};
use std::{
borrow::BorrowMut,
collections::{HashMap, HashSet},
net::SocketAddr,
path::PathBuf,
sync::Arc,
};

use fallible_iterator::FallibleIterator as _;
use futures::{StreamExt, TryFutureExt};
Expand Down Expand Up @@ -26,8 +32,6 @@ use tonic_health::{
pb::{HealthCheckRequest, health_client::HealthClient},
};

use crate::cli::Config;

#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("CUSF mainchain proto error")]
Expand Down Expand Up @@ -104,6 +108,18 @@ pub struct BlockTemplate {
pub fees: bitcoin::Amount,
}

#[derive(Debug)]
pub struct Config {
pub add_peers: HashSet<thunder::types::net::PeerAddress>,
pub datadir: PathBuf,
pub mainchain_grpc_url: url::Url,
pub mnemonic_seed_phrase_path: Option<PathBuf>,
pub net_addr: SocketAddr,
pub network: thunder::types::Network,
pub network_magic_override: Option<thunder::net::peer_message::MagicBytes>,
pub server_names: HashSet<String>,
}

#[derive(Clone)]
pub struct App {
pub node: Arc<Node>,
Expand Down Expand Up @@ -214,7 +230,7 @@ impl App {
Ok(res)
}

pub fn new(config: &Config) -> Result<Self, Error> {
pub fn new(config: Config) -> Result<Self, Error> {
// Node launches some tokio tasks for p2p networking, that is why we need a tokio runtime
// here.
let runtime = tokio::runtime::Builder::new_multi_thread()
Expand Down Expand Up @@ -278,11 +294,12 @@ impl App {
tracing::debug!("Instantiating node struct");
let node = Node::new(
thunder::node::Config {
datadir: &config.datadir,
add_peers: config.add_peers,
bind_addr: config.net_addr,
datadir: config.datadir,
magic_bytes_override: config.network_magic_override,
peers: &config.peers,
network: config.network,
server_names: config.server_names,
},
cusf_mainchain,
cusf_mainchain_wallet,
Expand Down
Loading
Loading