Fix panic when started for the first time without selecting a fork

Fix #530
This commit is contained in:
Will 2018-10-30 12:54:45 +01:00
parent b938b979fa
commit d2b94db993
No known key found for this signature in database
GPG Key ID: 2DCEC4DC506E6475
1 changed files with 5 additions and 5 deletions

View File

@ -196,11 +196,11 @@ fn parse_consensus_fork(network: Network, db: &storage::SharedStore, matches: &c
return Err(format!("Cannot select '{}' fork with non-empty database of '{}' fork", new_consensus_fork, old_consensus_fork)),
}
Ok(match new_consensus_fork {
"btc" => ConsensusFork::BitcoinCore,
"bch" => ConsensusFork::BitcoinCash(BitcoinCashConsensusParams::new(network)),
_ => unreachable!("hardcoded above"),
})
return match new_consensus_fork {
"btc" => Ok(ConsensusFork::BitcoinCore),
"bch" => Ok(ConsensusFork::BitcoinCash(BitcoinCashConsensusParams::new(network))),
_ => Err(String::from("Fork mandatory")),
};
}
fn parse_rpc_config(network: Network, matches: &clap::ArgMatches) -> Result<RpcHttpConfig, String> {