fn create_node_config(&mut self, idx: usize, first_node_port: u16) -> participating::Config {
        // Set the network configuration.
        let mut cfg = participating::Config {
            network: if idx == 0 {
                small_network::Config::default_local_net_first_node(first_node_port)
            } else {
                small_network::Config::default_local_net(first_node_port)
            },
            gossip: gossiper::Config::new_with_small_timeouts(),
            ..Default::default()
        };

        // Additionally set up storage in a temporary directory.
        let (storage_cfg, temp_dir) = storage::Config::default_for_tests();
        // ...and the secret key for our validator.
        {
            let secret_key_path = temp_dir.path().join("secret_key");
            self.keys[idx]
                .to_file(secret_key_path.clone())
                .expect("could not write secret key");
            cfg.consensus.secret_key_path = External::Path(secret_key_path);
        }
        self.storages.push(temp_dir);
        cfg.storage = storage_cfg;

        cfg
    }
/// Creates an initializer/validator configuration for the `idx`th validator.
Creates an initializer/validator configuration for the `idx`th validator.
Creates an initializer / validator configuration for the ` idx ` th validator .
fn create_node_config(&mut self, idx: usize, first_node_port: u16) -> participating::Config {
        // Set the network configuration.
        let mut cfg = participating::Config {
            network: if idx == 0 {
                small_network::Config::default_local_net_first_node(first_node_port)
            } else {
                small_network::Config::default_local_net(first_node_port)
            },
            gossip: gossiper::Config::new_with_small_timeouts(),
            ..Default::default()
        };
        // Additionally set up storage in a temporary directory.
        let (storage_cfg, temp_dir) = storage::Config::default_for_tests();
        // ...and the secret key for our validator.
        {
            let secret_key_path = temp_dir.path().join("secret_key");
            self.keys[idx]
                .to_file(secret_key_path.clone())
                .expect("could not write secret key");
            cfg.consensus.secret_key_path = External::Path(secret_key_path);
        }
        self.storages.push(temp_dir);
        cfg.storage = storage_cfg;
        cfg
    }
fn create_node_config ( & mut self , idx : usize , first_node_port : u16 ) -> participating :: Config { // Set the network configuration. let mut cfg = participating :: Config { network : if idx == 0 { small_network :: Config :: default_local_net_first_node ( first_node_port ) } else { small_network :: Config :: default_local_net ( first_node_port ) } , gossip : gossiper :: Config :: new_with_small_timeouts ( ) , .. Default :: default ( ) } ; // Additionally set up storage in a temporary directory. let ( storage_cfg , temp_dir ) = storage :: Config :: default_for_tests ( ) ; // ...and the secret key for our validator. { let secret_key_path = temp_dir . path ( ) . join ( " " ) ; self . keys [ idx ] . to_file ( secret_key_path . clone ( ) ) . expect ( " " ) ; cfg . consensus . secret_key_path = External :: Path ( secret_key_path ) ; } self . storages . push ( temp_dir ) ; cfg . storage = storage_cfg ; cfg }
Creates an initializer/validator configuration for the `idx`th validator.
Creates an initializer / validator configuration for the ` idx ` th validator .
&mut self
idx
usize
first_node_port
u16
&mut self
idx
usize
first_node_port
u16