Explorar o código

darkfid: renamed consensus_p2p to miners_p2p

skoupidi %!s(int64=2) %!d(string=hai) anos
pai
achega
38a83c8b40

+ 15 - 15
bin/darkfid/darkfid_config.toml

@@ -29,10 +29,10 @@ pow_target = 10
 # Optional fixed PoW difficulty, used for testing
 pow_fixed_difficulty = 1
 
-# Participate in the consensus protocol
-consensus = true
+# Participate in block production
+miner = true
 
-# Wallet address to receive consensus rewards.
+# Wallet address to receive mining rewards.
 # This is a dummy one so the miner can start,
 # replace with your own one.
 recipient = "5ZHfYpt4mpJcwBNxfEyxLzeFJUEeoePs5NQ5jVEgHrMf"
@@ -94,8 +94,8 @@ localnet = true
 # Time between peer discovery attempts
 #outbound_peer_discovery_attempt_time = 5
 
-## Localnet consensus P2P network settings
-[network_config."localnet".consensus_net]
+## Localnet miners P2P network settings
+[network_config."localnet".miners_net]
 # P2P accept addresses the instance listens on for inbound connections
 #inbound = ["tcp+tls://0.0.0.0:8241"]
 
@@ -158,10 +158,10 @@ minerd_endpoint = "tcp://127.0.0.1:28467"
 # PoW block production target, in seconds
 pow_target = 90
 
-# Participate in the consensus protocol
-consensus = false
+# Participate in block production
+miner = false
 
-# Wallet address to receive consensus rewards
+# Wallet address to receive mining rewards.
 #recipient = "YOUR_WALLET_ADDRESS_HERE"
 
 # Skip syncing process and start node right away
@@ -231,8 +231,8 @@ localnet = false
 # Time between peer discovery attempts
 #outbound_peer_discovery_attempt_time = 5
 
-## Testnet consensus P2P network settings
-[network_config."testnet".consensus_net]
+## Testnet miners P2P network settings
+[network_config."testnet".miners_net]
 # P2P accept addresses the instance listens on for inbound connections
 # You can also use an IPv6 address
 inbound = ["tcp+tls://0.0.0.0:8341"]
@@ -305,10 +305,10 @@ minerd_endpoint = "tcp://127.0.0.1:28467"
 # PoW block production target, in seconds
 pow_target = 90
 
-# Participate in the consensus protocol
-consensus = false
+# Participate in block production
+miner = false
 
-# Wallet address to receive consensus rewards
+# Wallet address to receive mining rewards.
 #recipient = "YOUR_WALLET_ADDRESS_HERE"
 
 # Skip syncing process and start node right away
@@ -378,8 +378,8 @@ localnet = false
 # Time between peer discovery attempts
 #outbound_peer_discovery_attempt_time = 5
 
-## Mainnet consensus P2P network settings
-[network_config."mainnet".consensus_net]
+## Mainnet miners P2P network settings
+[network_config."mainnet".miners_net]
 # P2P accept addresses the instance listens on for inbound connections
 # You can also use an IPv6 address
 inbound = ["tcp+tls://0.0.0.0:8441"]

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

@@ -65,7 +65,7 @@ mod proto;
 
 /// Utility functions
 mod utils;
-use utils::{parse_blockchain_config, spawn_consensus_p2p, spawn_sync_p2p};
+use utils::{parse_blockchain_config, spawn_miners_p2p, spawn_sync_p2p};
 
 const CONFIG_FILE: &str = "darkfid_config.toml";
 const CONFIG_FILE_CONTENTS: &str = include_str!("../darkfid_config.toml");
@@ -127,11 +127,11 @@ pub struct BlockchainNetwork {
     pub pow_fixed_difficulty: Option<usize>,
 
     #[structopt(long)]
-    /// Participate in the consensus protocol
-    pub consensus: bool,
+    /// Participate in block production
+    pub miner: bool,
 
     #[structopt(long)]
-    /// Wallet address to receive consensus rewards
+    /// Wallet address to receive mining rewards
     pub recipient: Option<String>,
 
     #[structopt(long)]
@@ -142,17 +142,17 @@ pub struct BlockchainNetwork {
     #[structopt(flatten)]
     pub sync_net: SettingsOpt,
 
-    /// Consensus network settings
+    /// Miners network settings
     #[structopt(flatten)]
-    pub consensus_net: SettingsOpt,
+    pub miners_net: SettingsOpt,
 }
 
 /// Daemon structure
 pub struct Darkfid {
     /// Syncing P2P network pointer
     sync_p2p: P2pPtr,
-    /// Optional consensus P2P network pointer
-    consensus_p2p: Option<P2pPtr>,
+    /// Optional miners P2P network pointer
+    miners_p2p: Option<P2pPtr>,
     /// Validator(node) pointer
     validator: ValidatorPtr,
     /// A map of various subscribers exporting live info from the blockchain
@@ -166,14 +166,14 @@ pub struct Darkfid {
 impl Darkfid {
     pub async fn new(
         sync_p2p: P2pPtr,
-        consensus_p2p: Option<P2pPtr>,
+        miners_p2p: Option<P2pPtr>,
         validator: ValidatorPtr,
         subscribers: HashMap<&'static str, JsonSubscriber>,
         rpc_client: Option<RpcClient>,
     ) -> Self {
         Self {
             sync_p2p,
-            consensus_p2p,
+            miners_p2p,
             validator,
             subscribers,
             rpc_connections: Mutex::new(HashSet::new()),
@@ -241,8 +241,8 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
         spawn_sync_p2p(&blockchain_config.sync_net.into(), &validator, &subscribers, ex.clone())
             .await;
 
-    // Initialize consensus P2P network
-    let (consensus_p2p, rpc_client) = if blockchain_config.consensus {
+    // Initialize miners P2P network
+    let (miners_p2p, rpc_client) = if blockchain_config.miner {
         let Ok(rpc_client) = RpcClient::new(blockchain_config.minerd_endpoint, ex.clone()).await
         else {
             error!(target: "darkfid", "Failed to initialize miner daemon rpc client, check if minerd is running");
@@ -250,8 +250,8 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
         };
         (
             Some(
-                spawn_consensus_p2p(
-                    &blockchain_config.consensus_net.into(),
+                spawn_miners_p2p(
+                    &blockchain_config.miners_net.into(),
                     &validator,
                     &subscribers,
                     ex.clone(),
@@ -267,7 +267,7 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
     // Initialize node
     let darkfid = Darkfid::new(
         sync_p2p.clone(),
-        consensus_p2p.clone(),
+        miners_p2p.clone(),
         validator.clone(),
         subscribers,
         rpc_client,
@@ -277,7 +277,7 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
     info!(target: "darkfid", "Node initialized successfully!");
 
     // Pinging minerd daemon to verify it listens
-    if blockchain_config.consensus {
+    if blockchain_config.miner {
         if let Err(e) = darkfid.ping_miner_daemon().await {
             error!(target: "darkfid", "Failed to ping miner daemon: {}", e);
             return Err(Error::RpcClientStopped)
@@ -307,13 +307,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
     info!(target: "darkfid", "Starting sync P2P network");
     sync_p2p.clone().start().await?;
 
-    // Consensus protocol
-    if blockchain_config.consensus {
-        info!(target: "darkfid", "Starting consensus P2P network");
-        let consensus_p2p = consensus_p2p.clone().unwrap();
-        consensus_p2p.clone().start().await?;
+    // Start miners P2P network
+    if blockchain_config.miner {
+        info!(target: "darkfid", "Starting miners P2P network");
+        let miners_p2p = miners_p2p.clone().unwrap();
+        miners_p2p.clone().start().await?;
     } else {
-        info!(target: "darkfid", "Not starting consensus P2P network");
+        info!(target: "darkfid", "Not starting miners P2P network");
     }
 
     // Sync blockchain
@@ -327,7 +327,7 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
     darkfid.validator.purge_pending_txs().await?;
 
     // Consensus protocol
-    let consensus_task = if blockchain_config.consensus {
+    let consensus_task = if blockchain_config.miner {
         info!(target: "darkfid", "Starting consensus protocol task");
         // Grab rewards recipient public key(address)
         if blockchain_config.recipient.is_none() {
@@ -368,9 +368,9 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
     info!(target: "darkfid", "Stopping syncing P2P network...");
     sync_p2p.stop().await;
 
-    if blockchain_config.consensus {
-        info!(target: "darkfid", "Stopping consensus P2P network...");
-        consensus_p2p.unwrap().stop().await;
+    if blockchain_config.miner {
+        info!(target: "darkfid", "Stopping miners P2P network...");
+        miners_p2p.unwrap().stop().await;
 
         info!(target: "darkfid", "Stopping consensus task...");
         consensus_task.unwrap().stop().await;

+ 7 - 7
bin/darkfid/src/proto/protocol_proposal.rs

@@ -60,7 +60,7 @@ impl ProtocolProposal {
         subscriber: JsonSubscriber,
     ) -> Result<ProtocolBasePtr> {
         debug!(
-            target: "validator::protocol_proposal::init",
+            target: "darkfid::proto::protocol_proposal::init",
             "Adding ProtocolProposal to the protocol registry"
         );
         let msg_subsystem = channel.message_subsystem();
@@ -79,14 +79,14 @@ impl ProtocolProposal {
     }
 
     async fn handle_receive_proposal(self: Arc<Self>) -> Result<()> {
-        debug!(target: "consensus::protocol_proposal::handle_receive_proposal", "START");
+        debug!(target: "darkfid::proto::protocol_proposal::handle_receive_proposal", "START");
         let exclude_list = vec![self.channel_address.clone()];
         loop {
             let proposal = match self.proposal_sub.receive().await {
                 Ok(v) => v,
                 Err(e) => {
                     debug!(
-                        target: "validator::protocol_proposal::handle_receive_proposal",
+                        target: "darkfid::proto::protocol_proposal::handle_receive_proposal",
                         "recv fail: {}",
                         e
                     );
@@ -97,7 +97,7 @@ impl ProtocolProposal {
             // Check if node has finished syncing its blockchain
             if !*self.validator.synced.read().await {
                 debug!(
-                    target: "validator::protocol_proposal::handle_receive_proposal",
+                    target: "darkfid::proto::protocol_proposal::handle_receive_proposal",
                     "Node still syncing blockchain, skipping..."
                 );
                 continue
@@ -114,7 +114,7 @@ impl ProtocolProposal {
                 }
                 Err(e) => {
                     debug!(
-                        target: "validator::protocol_proposal::handle_receive_proposal",
+                        target: "darkfid::proto::protocol_proposal::handle_receive_proposal",
                         "append_proposal fail: {}",
                         e
                     );
@@ -127,10 +127,10 @@ impl ProtocolProposal {
 #[async_trait]
 impl ProtocolBase for ProtocolProposal {
     async fn start(self: Arc<Self>, executor: Arc<Executor<'_>>) -> Result<()> {
-        debug!(target: "validator::protocol_proposal::start", "START");
+        debug!(target: "darkfid::proto::protocol_proposal::start", "START");
         self.jobsman.clone().start(executor.clone());
         self.jobsman.clone().spawn(self.clone().handle_receive_proposal(), executor.clone()).await;
-        debug!(target: "validator::protocol_proposal::start", "END");
+        debug!(target: "darkfid::proto::protocol_proposal::start", "END");
         Ok(())
     }
 

+ 8 - 8
bin/darkfid/src/proto/protocol_sync.rs

@@ -65,7 +65,7 @@ pub struct ProtocolSync {
 impl ProtocolSync {
     pub async fn init(channel: ChannelPtr, validator: ValidatorPtr) -> Result<ProtocolBasePtr> {
         debug!(
-            target: "validator::protocol_sync::init",
+            target: "darkfid::proto::protocol_sync::init",
             "Adding ProtocolSync to the protocol registry"
         );
         let msg_subsystem = channel.message_subsystem();
@@ -82,13 +82,13 @@ impl ProtocolSync {
     }
 
     async fn handle_receive_request(self: Arc<Self>) -> Result<()> {
-        debug!(target: "validator::protocol_sync::handle_receive_request", "START");
+        debug!(target: "darkfid::proto::protocol_sync::handle_receive_request", "START");
         loop {
             let request = match self.request_sub.receive().await {
                 Ok(v) => v,
                 Err(e) => {
                     debug!(
-                        target: "validator::protocol_sync::handle_receive_request",
+                        target: "darkfid::proto::protocol_sync::handle_receive_request",
                         "recv fail: {}",
                         e
                     );
@@ -99,7 +99,7 @@ impl ProtocolSync {
             // Check if node has finished syncing its blockchain
             if !*self.validator.synced.read().await {
                 debug!(
-                    target: "validator::protocol_sync::handle_receive_request",
+                    target: "darkfid::proto::protocol_sync::handle_receive_request",
                     "Node still syncing blockchain, skipping..."
                 );
                 continue
@@ -109,7 +109,7 @@ impl ProtocolSync {
                 Ok(v) => v,
                 Err(e) => {
                     error!(
-                        target: "validator::protocol_sync::handle_receive_request",
+                        target: "darkfid::proto::protocol_sync::handle_receive_request",
                         "get_blocks_after fail: {}",
                         e
                     );
@@ -120,7 +120,7 @@ impl ProtocolSync {
             let response = SyncResponse { blocks };
             if let Err(e) = self.channel.send(&response).await {
                 error!(
-                    target: "validator::protocol_sync::handle_receive_request",
+                    target: "darkfid::proto::protocol_sync::handle_receive_request",
                     "channel send fail: {}",
                     e
                 )
@@ -132,10 +132,10 @@ impl ProtocolSync {
 #[async_trait]
 impl ProtocolBase for ProtocolSync {
     async fn start(self: Arc<Self>, executor: Arc<Executor<'_>>) -> Result<()> {
-        debug!(target: "validator::protocol_sync::start", "START");
+        debug!(target: "darkfid::proto::protocol_sync::start", "START");
         self.jobsman.clone().start(executor.clone());
         self.jobsman.clone().spawn(self.clone().handle_receive_request(), executor.clone()).await;
-        debug!(target: "validator::protocol_sync::start", "END");
+        debug!(target: "darkfid::proto::protocol_sync::start", "END");
         Ok(())
     }
 

+ 7 - 7
bin/darkfid/src/proto/protocol_tx.rs

@@ -54,7 +54,7 @@ impl ProtocolTx {
         subscriber: JsonSubscriber,
     ) -> Result<ProtocolBasePtr> {
         debug!(
-            target: "validator::protocol_tx::init",
+            target: "darkfid::proto::protocol_tx::init",
             "Adding ProtocolTx to the protocol registry"
         );
         let msg_subsystem = channel.message_subsystem();
@@ -74,7 +74,7 @@ impl ProtocolTx {
 
     async fn handle_receive_tx(self: Arc<Self>) -> Result<()> {
         debug!(
-            target: "validator::protocol_tx::handle_receive_tx",
+            target: "darkfid::proto::protocol_tx::handle_receive_tx",
             "START"
         );
         let exclude_list = vec![self.channel_address.clone()];
@@ -83,7 +83,7 @@ impl ProtocolTx {
                 Ok(v) => v,
                 Err(e) => {
                     debug!(
-                        target: "validator::protocol_tx::handle_receive_tx",
+                        target: "darkfid::proto::protocol_tx::handle_receive_tx",
                         "recv fail: {}",
                         e
                     );
@@ -94,7 +94,7 @@ impl ProtocolTx {
             // Check if node has finished syncing its blockchain
             if !*self.validator.synced.read().await {
                 debug!(
-                    target: "validator::protocol_tx::handle_receive_tx",
+                    target: "darkfid::proto::protocol_tx::handle_receive_tx",
                     "Node still syncing blockchain, skipping..."
                 );
                 continue
@@ -112,7 +112,7 @@ impl ProtocolTx {
                 }
                 Err(e) => {
                     debug!(
-                        target: "validator::protocol_tx::handle_receive_tx",
+                        target: "darkfid::proto::protocol_tx::handle_receive_tx",
                         "append_tx fail: {}",
                         e
                     );
@@ -125,10 +125,10 @@ impl ProtocolTx {
 #[async_trait]
 impl ProtocolBase for ProtocolTx {
     async fn start(self: Arc<Self>, executor: Arc<Executor<'_>>) -> Result<()> {
-        debug!(target: "validator::protocol_tx::start", "START");
+        debug!(target: "darkfid::proto::protocol_tx::start", "START");
         self.jobsman.clone().start(executor.clone());
         self.jobsman.clone().spawn(self.clone().handle_receive_tx(), executor.clone()).await;
-        debug!(target: "validator::protocol_tx::start", "END");
+        debug!(target: "darkfid::proto::protocol_tx::start", "END");
         Ok(())
     }
 

+ 7 - 7
bin/darkfid/src/rpc.rs

@@ -51,7 +51,7 @@ impl RequestHandler for Darkfid {
             "ping" => return self.pong(req.id, req.params).await,
             "clock" => return self.clock(req.id, req.params).await,
             "sync_dnet_switch" => return self.sync_dnet_switch(req.id, req.params).await,
-            "consensus_dnet_switch" => return self.consensus_dnet_switch(req.id, req.params).await,
+            "miners_dnet_switch" => return self.miners_dnet_switch(req.id, req.params).await,
             "ping_miner" => return self.ping_miner(req.id, req.params).await,
 
             // ==================
@@ -121,24 +121,24 @@ impl Darkfid {
     }
 
     // RPCAPI:
-    // Activate or deactivate dnet in the consensus P2P stack.
+    // Activate or deactivate dnet in the miners P2P stack.
     // By sending `true`, dnet will be activated, and by sending `false` dnet
     // will be deactivated. Returns `true` on success.
     //
-    // --> {"jsonrpc": "2.0", "method": "consensus_dnet_switch", "params": [true], "id": 42}
+    // --> {"jsonrpc": "2.0", "method": "miners_dnet_switch", "params": [true], "id": 42}
     // <-- {"jsonrpc": "2.0", "result": true, "id": 42}
-    async fn consensus_dnet_switch(&self, id: u16, params: JsonValue) -> JsonResult {
+    async fn miners_dnet_switch(&self, id: u16, params: JsonValue) -> JsonResult {
         let params = params.get::<Vec<JsonValue>>().unwrap();
         if params.len() != 1 || !params[0].is_bool() {
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
         }
 
-        if self.consensus_p2p.is_some() {
+        if self.miners_p2p.is_some() {
             let switch = params[0].get::<bool>().unwrap();
             if *switch {
-                self.consensus_p2p.clone().unwrap().dnet_enable().await;
+                self.miners_p2p.as_ref().unwrap().dnet_enable().await;
             } else {
-                self.consensus_p2p.clone().unwrap().dnet_disable().await;
+                self.miners_p2p.as_ref().unwrap().dnet_disable().await;
             }
         }
 

+ 6 - 15
bin/darkfid/src/rpc_blockchain.rs

@@ -43,7 +43,7 @@ impl Darkfid {
     // * `array[0]`: `u64` Block height (as string)
     //
     // **Returns:**
-    // * [`BlockInfo`](https://darkrenaissance.github.io/darkfi/development/darkfi/consensus/block/struct.BlockInfo.html)
+    // * [`BlockInfo`](https://darkrenaissance.github.io/darkfi/dev/darkfi/blockchain/block_store/struct.BlockInfo.html)
     //   struct serialized into base64.
     //
     // --> {"jsonrpc": "2.0", "method": "blockchain.get_block", "params": ["0"], "id": 1}
@@ -83,7 +83,7 @@ impl Darkfid {
     // * `array[0]`: Hex-encoded transaction hash string
     //
     // **Returns:**
-    // * Serialized [`Transaction`](https://darkrenaissance.github.io/darkfi/development/darkfi/tx/struct.Transaction.html)
+    // * Serialized [`Transaction`](https://darkrenaissance.github.io/darkfi/dev/darkfi/tx/struct.Transaction.html)
     //   object encoded with base64
     //
     // --> {"jsonrpc": "2.0", "method": "blockchain.get_tx", "params": ["TxHash"], "id": 1}
@@ -174,9 +174,8 @@ impl Darkfid {
     }
 
     // RPCAPI:
-    // Initializes a subscription to new incoming proposals, asuming node participates
-    // in consensus. Once a subscription is established, `darkfid` will send JSON-RPC
-    // notifications of new incoming proposals to the subscriber.
+    // Initializes a subscription to new incoming proposals. Once a subscription is established,
+    // `darkfid` will send JSON-RPC notifications of new incoming proposals to the subscriber.
     //
     // --> {"jsonrpc": "2.0", "method": "blockchain.subscribe_proposals", "params": [], "id": 1}
     // <-- {"jsonrpc": "2.0", "method": "blockchain.subscribe_proposals", "params": [`blockinfo`]}
@@ -186,15 +185,7 @@ impl Darkfid {
             return JsonError::new(InvalidParams, None, id).into()
         }
 
-        // Since proposals subscriber is only active if we participate to consensus,
-        // we have to check if it actually exists in the subscribers map.
-        let proposals_subscriber = self.subscribers.get("proposals");
-        if proposals_subscriber.is_none() {
-            error!(target: "darkfid::rpc::blockchain_subscribe_proposals", "Proposals subscriber not found");
-            return JsonError::new(InternalError, None, id).into()
-        }
-
-        proposals_subscriber.unwrap().clone().into()
+        self.subscribers.get("proposals").unwrap().clone().into()
     }
 
     // RPCAPI:
@@ -206,7 +197,7 @@ impl Darkfid {
     //
     // **Returns:**
     // * `array[n]`: Pairs of: `zkas_namespace` string, serialized
-    //   [`ZkBinary`](https://darkrenaissance.github.io/darkfi/development/darkfi/zkas/decoder/struct.ZkBinary.html)
+    //   [`ZkBinary`](https://darkrenaissance.github.io/darkfi/dev/darkfi/zkas/decoder/struct.ZkBinary.html)
     //   object
     //
     // --> {"jsonrpc": "2.0", "method": "blockchain.lookup_zkas", "params": ["6Ef42L1KLZXBoxBuCDto7coi9DA2D2SRtegNqNU4sd74"], "id": 1}

+ 2 - 2
bin/darkfid/src/rpc_tx.rs

@@ -119,8 +119,8 @@ impl Darkfid {
             }
         };
 
-        if self.consensus_p2p.is_some() {
-            // Consensus participants can directly perform
+        if self.miners_p2p.is_some() {
+            // Block production participants can directly perform
             // the state transition check and append to their
             // pending transactions store.
             if self.validator.append_tx(&tx, true).await.is_err() {

+ 2 - 2
bin/darkfid/src/task/miner.rs

@@ -46,7 +46,7 @@ use crate::{proto::ProposalMessage, Darkfid};
 
 // TODO: handle all ? so the task don't stop on errors
 
-/// async task used for participating in the PoW consensus protocol
+/// async task used for participating in the PoW block production
 pub async fn miner_task(node: &Darkfid, recipient: &PublicKey) -> Result<()> {
     // TODO: For now we asume we have a single miner that produces block,
     //       until the PoW consensus and proper validations have been added.
@@ -125,7 +125,7 @@ async fn miner_loop(node: &Darkfid, recipient: &PublicKey) -> Result<()> {
 
         // Broadcast proposal to the network
         let message = ProposalMessage(proposal);
-        node.consensus_p2p.as_ref().unwrap().broadcast(&message).await;
+        node.miners_p2p.as_ref().unwrap().broadcast(&message).await;
         node.sync_p2p.broadcast(&message).await;
 
         // Check if we can finalize anything and broadcast them

+ 17 - 17
bin/darkfid/src/tests/harness.rs

@@ -45,7 +45,7 @@ use url::Url;
 use crate::{
     proto::ProposalMessage,
     task::sync::sync_task,
-    utils::{spawn_consensus_p2p, spawn_sync_p2p},
+    utils::{spawn_miners_p2p, spawn_sync_p2p},
     Darkfid,
 };
 
@@ -99,19 +99,19 @@ impl Harness {
         let (_, vks) = vks::get_cached_pks_and_vks()?;
         let mut sync_settings =
             Settings { localnet: true, inbound_connections: 3, ..Default::default() };
-        let mut consensus_settings =
+        let mut miners_settings =
             Settings { localnet: true, inbound_connections: 3, ..Default::default() };
 
         // Alice
         let alice_url = Url::parse("tcp+tls://127.0.0.1:18340")?;
         sync_settings.inbound_addrs = vec![alice_url.clone()];
-        let alice_consensus_url = Url::parse("tcp+tls://127.0.0.1:18350")?;
-        consensus_settings.inbound_addrs = vec![alice_consensus_url.clone()];
+        let alice_miners_url = Url::parse("tcp+tls://127.0.0.1:18350")?;
+        miners_settings.inbound_addrs = vec![alice_miners_url.clone()];
         let alice = generate_node(
             &vks,
             &validator_config,
             &sync_settings,
-            Some(&consensus_settings),
+            Some(&miners_settings),
             ex,
             true,
         )
@@ -121,14 +121,14 @@ impl Harness {
         let bob_url = Url::parse("tcp+tls://127.0.0.1:18341")?;
         sync_settings.inbound_addrs = vec![bob_url];
         sync_settings.peers = vec![alice_url];
-        let bob_consensus_url = Url::parse("tcp+tls://127.0.0.1:18351")?;
-        consensus_settings.inbound_addrs = vec![bob_consensus_url];
-        consensus_settings.peers = vec![alice_consensus_url];
+        let bob_miners_url = Url::parse("tcp+tls://127.0.0.1:18351")?;
+        miners_settings.inbound_addrs = vec![bob_miners_url];
+        miners_settings.peers = vec![alice_miners_url];
         let bob = generate_node(
             &vks,
             &validator_config,
             &sync_settings,
-            Some(&consensus_settings),
+            Some(&miners_settings),
             ex,
             false,
         )
@@ -163,7 +163,7 @@ impl Harness {
             let proposal = Proposal::new(block.clone())?;
             self.alice.validator.consensus.append_proposal(&proposal).await?;
             let message = ProposalMessage(proposal);
-            self.alice.consensus_p2p.as_ref().unwrap().broadcast(&message).await;
+            self.alice.miners_p2p.as_ref().unwrap().broadcast(&message).await;
         }
 
         // Sleep a bit so blocks can be propagated and then
@@ -244,7 +244,7 @@ pub async fn generate_node(
     vks: &Vec<(Vec<u8>, String, Vec<u8>)>,
     config: &ValidatorConfig,
     sync_settings: &Settings,
-    consensus_settings: Option<&Settings>,
+    miners_settings: Option<&Settings>,
     ex: &Arc<smol::Executor<'static>>,
     skip_sync: bool,
 ) -> Result<Darkfid> {
@@ -259,19 +259,19 @@ pub async fn generate_node(
     subscribers.insert("proposals", JsonSubscriber::new("blockchain.subscribe_proposals"));
 
     let sync_p2p = spawn_sync_p2p(sync_settings, &validator, &subscribers, ex.clone()).await;
-    let consensus_p2p = if let Some(settings) = consensus_settings {
-        Some(spawn_consensus_p2p(settings, &validator, &subscribers, ex.clone()).await)
+    let miners_p2p = if let Some(settings) = miners_settings {
+        Some(spawn_miners_p2p(settings, &validator, &subscribers, ex.clone()).await)
     } else {
         None
     };
     let node =
-        Darkfid::new(sync_p2p.clone(), consensus_p2p.clone(), validator, subscribers, None).await;
+        Darkfid::new(sync_p2p.clone(), miners_p2p.clone(), validator, subscribers, None).await;
 
     sync_p2p.clone().start().await?;
 
-    if consensus_settings.is_some() {
-        let consensus_p2p = consensus_p2p.unwrap();
-        consensus_p2p.clone().start().await?;
+    if miners_settings.is_some() {
+        let miners_p2p = miners_p2p.unwrap();
+        miners_p2p.clone().start().await?;
     }
 
     if !skip_sync {

+ 3 - 3
bin/darkfid/src/utils.rs

@@ -77,14 +77,14 @@ pub async fn spawn_sync_p2p(
     p2p
 }
 
-/// Auxiliary function to generate the consensus P2P network and register all its protocols.
-pub async fn spawn_consensus_p2p(
+/// Auxiliary function to generate the miners P2P network and register all its protocols.
+pub async fn spawn_miners_p2p(
     settings: &Settings,
     validator: &ValidatorPtr,
     subscribers: &HashMap<&'static str, JsonSubscriber>,
     executor: Arc<Executor<'static>>,
 ) -> P2pPtr {
-    info!(target: "darkfid", "Registering consensus network P2P protocols...");
+    info!(target: "darkfid", "Registering miners network P2P protocols...");
     let p2p = P2p::new(settings.clone(), executor.clone()).await;
     let registry = p2p.protocol_registry();