Add validator token to config (RIPD-1386)

This commit is contained in:
wilsonianb
2017-01-18 15:01:50 -08:00
committed by seelabs
parent 2fcde0e0b6
commit a8cf5e0a5c
29 changed files with 372 additions and 191 deletions

View File

@@ -358,22 +358,10 @@ void Config::loadFromString (std::string const& fileContents)
if (getSingleSection (secConfig, SECTION_SSL_VERIFY, strTemp, j_))
SSL_VERIFY = beast::lexicalCastThrow <bool> (strTemp);
if (getSingleSection (secConfig, SECTION_VALIDATION_SEED, strTemp, j_))
{
auto const seed = parseBase58<Seed>(strTemp);
if (!seed)
Throw<std::runtime_error> (
"Invalid seed specified in [" SECTION_VALIDATION_SEED "]");
VALIDATION_PRIV = generateSecretKey (KeyType::secp256k1, *seed);
VALIDATION_PUB = derivePublicKey (KeyType::secp256k1, VALIDATION_PRIV);
}
if (getSingleSection (secConfig, SECTION_NODE_SEED, NODE_SEED, j_))
{
if (!parseBase58<Seed>(NODE_SEED))
Throw<std::runtime_error> (
"Invalid seed specified in [" SECTION_NODE_SEED "]");
}
if (exists(SECTION_VALIDATION_SEED) && exists(SECTION_VALIDATOR_TOKEN))
Throw<std::runtime_error> (
"Cannot have both [" SECTION_VALIDATION_SEED "] "
"and [" SECTION_VALIDATOR_TOKEN "] config sections");
if (getSingleSection (secConfig, SECTION_NETWORK_QUORUM, strTemp, j_))
NETWORK_QUORUM = beast::lexicalCastThrow <std::size_t> (strTemp);