fn new_with_keys(
        rng: &mut TestRng,
        keys: Vec<Arc<SecretKey>>,
        stakes: BTreeMap<PublicKey, U512>,
    ) -> Self {
        // Load the `local` chainspec.
        let mut chainspec = Chainspec::from_resources("local");

        // Override accounts with those generated from the keys.
        let accounts = stakes
            .into_iter()
            .map(|(public_key, bonded_amount)| {
                let validator_config =
                    ValidatorConfig::new(Motes::new(bonded_amount), DelegationRate::zero());
                AccountConfig::new(
                    public_key,
                    Motes::new(U512::from(rng.gen_range(10000..99999999))),
                    Some(validator_config),
                )
            })
            .collect();
        let delegators = vec![];
        chainspec.network_config.accounts_config = AccountsConfig::new(accounts, delegators);

        // Make the genesis timestamp 45 seconds from now, to allow for all validators to start up.
        let genesis_time = Timestamp::now() + 45000.into();
        info!(
            "creating test chain configuration, genesis: {}",
            genesis_time
        );
        chainspec.protocol_config.activation_point = ActivationPoint::Genesis(genesis_time);

        chainspec.core_config.minimum_era_height = 1;
        chainspec.highway_config.finality_threshold_fraction = Ratio::new(34, 100);
        chainspec.core_config.era_duration = 10.into();
        chainspec.core_config.auction_delay = 1;
        chainspec.core_config.unbonding_delay = 3;

        TestChain {
            keys,
            chainspec: Arc::new(chainspec),
            storages: Vec::new(),
        }
    }
/// Instantiates a new test chain configuration.
///
/// Takes a vector of bonded keys with specified bond amounts.
Instantiates a new test chain configuration.
Takes a vector of bonded keys with specified bond amounts.
Instantiates a new test chain configuration . Takes a vector of bonded keys with specified bond amounts .
fn new_with_keys(
        rng: &mut TestRng,
        keys: Vec<Arc<SecretKey>>,
        stakes: BTreeMap<PublicKey, U512>,
    ) -> Self {
        // Load the `local` chainspec.
        let mut chainspec = Chainspec::from_resources("local");
        // Override accounts with those generated from the keys.
        let accounts = stakes
            .into_iter()
            .map(|(public_key, bonded_amount)| {
                let validator_config =
                    ValidatorConfig::new(Motes::new(bonded_amount), DelegationRate::zero());
                AccountConfig::new(
                    public_key,
                    Motes::new(U512::from(rng.gen_range(10000..99999999))),
                    Some(validator_config),
                )
            })
            .collect();
        let delegators = vec![];
        chainspec.network_config.accounts_config = AccountsConfig::new(accounts, delegators);
        // Make the genesis timestamp 45 seconds from now, to allow for all validators to start up.
        let genesis_time = Timestamp::now() + 45000.into();
        info!(
            "creating test chain configuration, genesis: {}",
            genesis_time
        );
        chainspec.protocol_config.activation_point = ActivationPoint::Genesis(genesis_time);
        chainspec.core_config.minimum_era_height = 1;
        chainspec.highway_config.finality_threshold_fraction = Ratio::new(34, 100);
        chainspec.core_config.era_duration = 10.into();
        chainspec.core_config.auction_delay = 1;
        chainspec.core_config.unbonding_delay = 3;
        TestChain {
            keys,
            chainspec: Arc::new(chainspec),
            storages: Vec::new(),
        }
    }
fn new_with_keys ( rng : & mut TestRng , keys : Vec < Arc < SecretKey > > , stakes : BTreeMap < PublicKey , U512 > , ) -> Self { // Load the `local` chainspec. let mut chainspec = Chainspec :: from_resources ( " " ) ; // Override accounts with those generated from the keys. let accounts = stakes . into_iter ( ) . map ( | ( public_key , bonded_amount ) | { let validator_config = ValidatorConfig :: new ( Motes :: new ( bonded_amount ) , DelegationRate :: zero ( ) ) ; AccountConfig :: new ( public_key , Motes :: new ( U512 :: from ( rng . gen_range ( 10000 .. 99999999 ) ) ) , Some ( validator_config ) , ) } ) . collect ( ) ; let delegators = vec ! [ ] ; chainspec . network_config . accounts_config = AccountsConfig :: new ( accounts , delegators ) ; // Make the genesis timestamp 45 seconds from now, to allow for all validators to start up. let genesis_time = Timestamp :: now ( ) + 45000 . into ( ) ; info ! ( " " genesis_time ) ; chainspec . protocol_config . activation_point = ActivationPoint :: Genesis ( genesis_time ) ; chainspec . core_config . minimum_era_height = 1 ; chainspec . highway_config . finality_threshold_fraction = Ratio :: new ( 34 , 100 ) ; chainspec . core_config . era_duration = 10 . into ( ) ; chainspec . core_config . auction_delay = 1 ; chainspec . core_config . unbonding_delay = 3 ; TestChain { keys , chainspec : Arc :: new ( chainspec ) , storages : Vec :: new ( ) , } }
Instantiates a new test chain configuration.
Instantiates a new test chain configuration .
rng
&mut TestRng
keys
Vec<Arc<SecretKey>>
stakes
BTreeMap<PublicKey, U512>
rng
&mut TestRng
keys
Vec<Arc<SecretKey>>
stakes
BTreeMap<PublicKey, U512>