darkfid: moved all relative args under blockchain config args

This commit is contained in:
skoupidi
2024-06-20 15:10:55 +03:00
parent 563f04f963
commit 186e3302d3
14 changed files with 62 additions and 50 deletions

View File

@@ -6,19 +6,16 @@
## The default values are left commented. They can be overridden either by ## The default values are left commented. They can be overridden either by
## uncommenting, or by using the command-line. ## uncommenting, or by using the command-line.
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:8340"
# Blockchain network to use # Blockchain network to use
network = "testnet" network = "testnet"
# Garbage collection task transactions batch size
txs_batch_size = 50
# Localnet blockchain network configuration # Localnet blockchain network configuration
[network_config."localnet"] [network_config."localnet"]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:8240"
# Path to the blockchain database directory # Path to the blockchain database directory
database = "~/.local/darkfi/darkfid_blockchain_localnet" database = "~/.local/darkfi/darkfid/localnet"
# Finalization threshold, denominated by number of blocks # Finalization threshold, denominated by number of blocks
threshold = 3 threshold = 3
@@ -61,6 +58,9 @@ skip_fees = false
# Optional bootstrap timestamp # Optional bootstrap timestamp
#bootstrap = 1712581283 #bootstrap = 1712581283
# Garbage collection task transactions batch size
txs_batch_size = 50
## Localnet P2P network settings ## Localnet P2P network settings
[network_config."localnet".net] [network_config."localnet".net]
# P2P accept addresses the instance listens on for inbound connections # P2P accept addresses the instance listens on for inbound connections
@@ -120,8 +120,11 @@ localnet = true
# Testnet blockchain network configuration # Testnet blockchain network configuration
[network_config."testnet"] [network_config."testnet"]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:8340"
# Path to the blockchain database directory # Path to the blockchain database directory
database = "~/.local/darkfi/darkfid_blockchain_testnet" database = "~/.local/darkfi/darkfid/testnet"
# Finalization threshold, denominated by number of blocks # Finalization threshold, denominated by number of blocks
threshold = 6 threshold = 6
@@ -159,6 +162,9 @@ skip_fees = false
# Optional bootstrap timestamp # Optional bootstrap timestamp
#bootstrap = 1712581283 #bootstrap = 1712581283
# Garbage collection task transactions batch size
txs_batch_size = 50
## Testnet P2P network settings ## Testnet P2P network settings
[network_config."testnet".net] [network_config."testnet".net]
# P2P accept addresses the instance listens on for inbound connections # P2P accept addresses the instance listens on for inbound connections
@@ -222,8 +228,11 @@ localnet = false
# Mainnet blockchain network configuration # Mainnet blockchain network configuration
[network_config."mainnet"] [network_config."mainnet"]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:8440"
# Path to the blockchain database directory # Path to the blockchain database directory
database = "~/.local/darkfi/darkfid_blockchain_mainnet" database = "~/.local/darkfi/darkfid/mainnet"
# Finalization threshold, denominated by number of blocks # Finalization threshold, denominated by number of blocks
threshold = 11 threshold = 11
@@ -261,6 +270,9 @@ skip_fees = false
# Optional bootstrap timestamp # Optional bootstrap timestamp
#bootstrap = 1712581283 #bootstrap = 1712581283
# Garbage collection task transactions batch size
txs_batch_size = 50
## Mainnet P2P network settings ## Mainnet P2P network settings
[network_config."mainnet".net] [network_config."mainnet".net]
# P2P accept addresses the instance listens on for inbound connections # P2P accept addresses the instance listens on for inbound connections

View File

@@ -82,18 +82,10 @@ struct Args {
/// Configuration file to use /// Configuration file to use
config: Option<String>, config: Option<String>,
#[structopt(short, long, default_value = "tcp://127.0.0.1:8340")]
/// JSON-RPC listen URL
rpc_listen: Url,
#[structopt(short, long, default_value = "testnet")] #[structopt(short, long, default_value = "testnet")]
/// Blockchain network to use /// Blockchain network to use
network: String, network: String,
#[structopt(long, default_value = "50")]
/// Garbage collection task transactions batch size
txs_batch_size: usize,
#[structopt(short, long)] #[structopt(short, long)]
/// Set log file to ouput into /// Set log file to ouput into
log: Option<String>, log: Option<String>,
@@ -108,7 +100,11 @@ struct Args {
#[derive(Clone, Debug, serde::Deserialize, structopt::StructOpt, structopt_toml::StructOptToml)] #[derive(Clone, Debug, serde::Deserialize, structopt::StructOpt, structopt_toml::StructOptToml)]
#[structopt()] #[structopt()]
pub struct BlockchainNetwork { pub struct BlockchainNetwork {
#[structopt(long, default_value = "~/.local/darkfi/darkfid_blockchain_localnet")] #[structopt(short, long, default_value = "tcp://127.0.0.1:8240")]
/// JSON-RPC listen URL
pub rpc_listen: Url,
#[structopt(long, default_value = "~/.local/darkfi/darkfid/localnet")]
/// Path to blockchain database /// Path to blockchain database
pub database: String, pub database: String,
@@ -164,6 +160,10 @@ pub struct BlockchainNetwork {
/// Optional bootstrap timestamp /// Optional bootstrap timestamp
pub bootstrap: Option<u64>, pub bootstrap: Option<u64>,
#[structopt(long, default_value = "50")]
/// Garbage collection task transactions batch size
pub txs_batch_size: usize,
/// P2P network settings /// P2P network settings
#[structopt(flatten)] #[structopt(flatten)]
pub net: SettingsOpt, pub net: SettingsOpt,
@@ -304,7 +304,7 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
p2p.clone(), p2p.clone(),
validator, validator,
blockchain_config.miner, blockchain_config.miner,
args.txs_batch_size, blockchain_config.txs_batch_size,
subscribers, subscribers,
rpc_client, rpc_client,
) )
@@ -329,7 +329,7 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
let rpc_task = StoppableTask::new(); let rpc_task = StoppableTask::new();
let darkfid_ = darkfid.clone(); let darkfid_ = darkfid.clone();
rpc_task.clone().start( rpc_task.clone().start(
listen_and_serve(args.rpc_listen, darkfid.clone(), None, ex.clone()), listen_and_serve(blockchain_config.rpc_listen, darkfid.clone(), None, ex.clone()),
|res| async move { |res| async move {
match res { match res {
Ok(()) | Err(Error::RpcServerStopped) => darkfid_.stop_connections().await, Ok(()) | Err(Error::RpcServerStopped) => darkfid_.stop_connections().await,

View File

@@ -13,4 +13,4 @@ wallet_path = "~/.local/darkfi/drk/wallet.db"
wallet_pass = "changeme" wallet_pass = "changeme"
# darkfid JSON-RPC endpoint # darkfid JSON-RPC endpoint
endpoint = "tcp://127.0.0.1:8340" endpoint = "tcp://127.0.0.1:8240"

View File

@@ -81,7 +81,7 @@ struct Args {
/// Password for the wallet database /// Password for the wallet database
wallet_pass: String, wallet_pass: String,
#[structopt(short, long, default_value = "tcp://127.0.0.1:8340")] #[structopt(short, long, default_value = "tcp://127.0.0.1:8240")]
/// darkfid JSON-RPC endpoint /// darkfid JSON-RPC endpoint
endpoint: Url, endpoint: Url,

View File

@@ -6,14 +6,14 @@
## The default values are left commented. They can be overridden either by ## The default values are left commented. They can be overridden either by
## uncommenting, or by using the command-line. ## uncommenting, or by using the command-line.
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48340"
# Blockchain network to use # Blockchain network to use
network = "localnet" network = "localnet"
# Localnet blockchain network configuration # Localnet blockchain network configuration
[network_config."localnet"] [network_config."localnet"]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48240"
# Path to the blockchain database directory # Path to the blockchain database directory
database = "darkfid0" database = "darkfid0"

View File

@@ -6,14 +6,14 @@
## The default values are left commented. They can be overridden either by ## The default values are left commented. They can be overridden either by
## uncommenting, or by using the command-line. ## uncommenting, or by using the command-line.
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48440"
# Blockchain network to use # Blockchain network to use
network = "localnet" network = "localnet"
# Localnet blockchain network configuration # Localnet blockchain network configuration
[network_config."localnet"] [network_config."localnet"]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48340"
# Path to the blockchain database directory # Path to the blockchain database directory
database = "darkfid1" database = "darkfid1"

View File

@@ -6,14 +6,14 @@
## The default values are left commented. They can be overridden either by ## The default values are left commented. They can be overridden either by
## uncommenting, or by using the command-line. ## uncommenting, or by using the command-line.
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48540"
# Blockchain network to use # Blockchain network to use
network = "localnet" network = "localnet"
# Localnet blockchain network configuration # Localnet blockchain network configuration
[network_config."localnet"] [network_config."localnet"]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48440"
# Path to the blockchain database directory # Path to the blockchain database directory
database = "darkfid2" database = "darkfid2"

View File

@@ -6,14 +6,14 @@
## The default values are left commented. They can be overridden either by ## The default values are left commented. They can be overridden either by
## uncommenting, or by using the command-line. ## uncommenting, or by using the command-line.
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48640"
# Blockchain network to use # Blockchain network to use
network = "localnet" network = "localnet"
# Localnet blockchain network configuration # Localnet blockchain network configuration
[network_config."localnet"] [network_config."localnet"]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48540"
# Path to the blockchain database directory # Path to the blockchain database directory
database = "darkfid3" database = "darkfid3"

View File

@@ -6,14 +6,14 @@
## The default values are left commented. They can be overridden either by ## The default values are left commented. They can be overridden either by
## uncommenting, or by using the command-line. ## uncommenting, or by using the command-line.
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48740"
# Blockchain network to use # Blockchain network to use
network = "localnet" network = "localnet"
# Localnet blockchain network configuration # Localnet blockchain network configuration
[network_config."localnet"] [network_config."localnet"]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48640"
# Path to the blockchain database directory # Path to the blockchain database directory
database = "darkfid4" database = "darkfid4"

View File

@@ -6,14 +6,14 @@
## The default values are left commented. They can be overridden either by ## The default values are left commented. They can be overridden either by
## uncommenting, or by using the command-line. ## uncommenting, or by using the command-line.
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48340"
# Blockchain network to use # Blockchain network to use
network = "localnet" network = "localnet"
# Localnet blockchain network configuration # Localnet blockchain network configuration
[network_config."localnet"] [network_config."localnet"]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48240"
# Path to the blockchain database directory # Path to the blockchain database directory
database = "darkfid" database = "darkfid"

View File

@@ -13,4 +13,4 @@ wallet_path = "drk/wallet.db"
wallet_pass = "testing" wallet_pass = "testing"
# darkfid JSON-RPC endpoint # darkfid JSON-RPC endpoint
endpoint = "tcp://127.0.0.1:48340" endpoint = "tcp://127.0.0.1:48240"

View File

@@ -6,14 +6,14 @@
## The default values are left commented. They can be overridden either by ## The default values are left commented. They can be overridden either by
## uncommenting, or by using the command-line. ## uncommenting, or by using the command-line.
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48340"
# Blockchain network to use # Blockchain network to use
network = "localnet" network = "localnet"
# Localnet blockchain network configuration # Localnet blockchain network configuration
[network_config."localnet"] [network_config."localnet"]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48240"
# Path to the blockchain database directory # Path to the blockchain database directory
database = "darkfid0" database = "darkfid0"

View File

@@ -14,14 +14,14 @@
## The default values are left commented. They can be overridden either by ## The default values are left commented. They can be overridden either by
## uncommenting, or by using the command-line. ## uncommenting, or by using the command-line.
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48440"
# Blockchain network to use # Blockchain network to use
network = "localnet" network = "localnet"
# Localnet blockchain network configuration # Localnet blockchain network configuration
[network_config."localnet"] [network_config."localnet"]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48340"
# Path to the blockchain database directory # Path to the blockchain database directory
database = "darkfid1" database = "darkfid1"

View File

@@ -6,14 +6,14 @@
## The default values are left commented. They can be overridden either by ## The default values are left commented. They can be overridden either by
## uncommenting, or by using the command-line. ## uncommenting, or by using the command-line.
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48540"
# Blockchain network to use # Blockchain network to use
network = "localnet" network = "localnet"
# Localnet blockchain network configuration # Localnet blockchain network configuration
[network_config."localnet"] [network_config."localnet"]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:48440"
# Path to the blockchain database directory # Path to the blockchain database directory
database = "darkfid2" database = "darkfid2"