Explorar o código

darkfid: moved all relative args under blockchain config args

skoupidi %!s(int64=2) %!d(string=hai) anos
pai
achega
186e3302d3

+ 21 - 9
bin/darkfid/darkfid_config.toml

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

+ 11 - 11
bin/darkfid/src/main.rs

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

+ 1 - 1
bin/drk/drk_config.toml

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

+ 1 - 1
bin/drk/src/main.rs

@@ -81,7 +81,7 @@ struct Args {
     /// Password for the wallet database
     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
     endpoint: Url,
 

+ 3 - 3
contrib/localnet/darkfid-five-nodes/darkfid0.toml

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

+ 3 - 3
contrib/localnet/darkfid-five-nodes/darkfid1.toml

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

+ 3 - 3
contrib/localnet/darkfid-five-nodes/darkfid2.toml

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

+ 3 - 3
contrib/localnet/darkfid-five-nodes/darkfid3.toml

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

+ 3 - 3
contrib/localnet/darkfid-five-nodes/darkfid4.toml

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

+ 3 - 3
contrib/localnet/darkfid-single-node/darkfid.toml

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

+ 1 - 1
contrib/localnet/darkfid-single-node/drk.toml

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

+ 3 - 3
contrib/localnet/darkfid-small/darkfid0.toml

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

+ 3 - 3
contrib/localnet/darkfid-small/darkfid1.toml

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

+ 3 - 3
contrib/localnet/darkfid-small/darkfid2.toml

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