fn minor_010_upgrade(
    mut config: Config,
    _matches: &ArgMatches,
    config_version: &Version,
    package_version: &Version,
) -> Config {
    let to_version = if package_version.major == 0 && package_version.minor == 10 {
        package_version.clone()
    } else {
        Version::new(0, 10, 0)
    };

    print_start_upgrade(&config_version, &to_version);

    config
        .get_base_mut()
        .set_custom_version(to_version.to_string().as_ref());

    if config.get_base().get_validator_mixnet_contract_address() != MISSING_VALUE {
        eprintln!("existing config seems to have specified mixnet contract address which was only introduced in 0.10.0! Can't perform upgrade.");
        print_failed_upgrade(&config_version, &to_version);
        process::exit(1);
    }

    println!(
        "Setting mixnet contract address to {}",
        DEFAULT_MIXNET_CONTRACT_ADDRESS
    );

    config
        .get_base_mut()
        .set_mixnet_contract(DEFAULT_MIXNET_CONTRACT_ADDRESS);

    // The default validator endpoint changed
    println!(
        "Setting validator REST endpoint to to {}",
        DEFAULT_VALIDATOR_REST_ENDPOINT
    );

    config
        .get_base_mut()
        .set_custom_validator(DEFAULT_VALIDATOR_REST_ENDPOINT);

    config.save_to_file(None).unwrap_or_else(|err| {
        eprintln!("failed to overwrite config file! - {:?}", err);
        print_failed_upgrade(&config_version, &to_version);
        process::exit(1);
    });

    print_successful_upgrade(config_version, to_version);

    config
}
/*
changes:
- introduction of mixnet contract address field
- change to default validator rest endpoint
 */
introduction of mixnet contract address field
change to default validator rest endpoint
introduction of mixnet contract address field change to default validator rest endpoint
fn minor_010_upgrade(
    mut config: Config,
    _matches: &ArgMatches,
    config_version: &Version,
    package_version: &Version,
) -> Config {
    let to_version = if package_version.major == 0 && package_version.minor == 10 {
        package_version.clone()
    } else {
        Version::new(0, 10, 0)
    };
    print_start_upgrade(&config_version, &to_version);
    config
        .get_base_mut()
        .set_custom_version(to_version.to_string().as_ref());
    if config.get_base().get_validator_mixnet_contract_address() != MISSING_VALUE {
        eprintln!("existing config seems to have specified mixnet contract address which was only introduced in 0.10.0! Can't perform upgrade.");
        print_failed_upgrade(&config_version, &to_version);
        process::exit(1);
    }
    println!(
        "Setting mixnet contract address to {}",
        DEFAULT_MIXNET_CONTRACT_ADDRESS
    );
    config
        .get_base_mut()
        .set_mixnet_contract(DEFAULT_MIXNET_CONTRACT_ADDRESS);
    // The default validator endpoint changed
    println!(
        "Setting validator REST endpoint to to {}",
        DEFAULT_VALIDATOR_REST_ENDPOINT
    );
    config
        .get_base_mut()
        .set_custom_validator(DEFAULT_VALIDATOR_REST_ENDPOINT);
    config.save_to_file(None).unwrap_or_else(|err| {
        eprintln!("failed to overwrite config file! - {:?}", err);
        print_failed_upgrade(&config_version, &to_version);
        process::exit(1);
    });
    print_successful_upgrade(config_version, to_version);
    config
}
fn minor_010_upgrade ( mut config : Config , _matches : & ArgMatches , config_version : & Version , package_version : & Version , ) -> Config { let to_version = if package_version . major == 0 && package_version . minor == 10 { package_version . clone ( ) } else { Version :: new ( 0 , 10 , 0 ) } ; print_start_upgrade ( & config_version , & to_version ) ; config . get_base_mut ( ) . set_custom_version ( to_version . to_string ( ) . as_ref ( ) ) ; if config . get_base ( ) . get_validator_mixnet_contract_address ( ) != MISSING_VALUE { eprintln ! ( " " ) ; print_failed_upgrade ( & config_version , & to_version ) ; process :: exit ( 1 ) ; } println ! ( " " DEFAULT_MIXNET_CONTRACT_ADDRESS ) ; config . get_base_mut ( ) . set_mixnet_contract ( DEFAULT_MIXNET_CONTRACT_ADDRESS ) ; // The default validator endpoint changed println ! ( " " DEFAULT_VALIDATOR_REST_ENDPOINT ) ; config . get_base_mut ( ) . set_custom_validator ( DEFAULT_VALIDATOR_REST_ENDPOINT ) ; config . save_to_file ( None ) . unwrap_or_else ( | err | { eprintln ! ( " " err ) ; print_failed_upgrade ( & config_version , & to_version ) ; process :: exit ( 1 ) ; } ) ; print_successful_upgrade ( config_version , to_version ) ; config }
changes:
introduction of mixnet contract address field
change to default validator rest endpoint
changes : introduction of mixnet contract address field change to default validator rest endpoint
config
Config
_matches
&ArgMatches
config_version
&Version
package_version
&Version
config
Config
_matches
&ArgMatches
config_version
&Version
package_version
&Version