Skip to content

Commit

Permalink
Put network id in database and abort if verification fails
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptocode committed Aug 30, 2018
1 parent 3385473 commit 7fc2e4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rai/lib/utility.cpp
Expand Up @@ -9,5 +9,5 @@ void release_assert_internal (bool check, const char * check_expr, const char *
}

std::cerr << "Assertion (" << check_expr << ") failed " << file << ":" << line << std::endl;
abort();
abort ();
}
8 changes: 7 additions & 1 deletion rai/node/node.cpp
Expand Up @@ -1855,13 +1855,19 @@ stats (config.stat_config)
{
BOOST_LOG (log) << "Constructing node";
}
rai::genesis genesis;
rai::transaction transaction (store.environment, true);
if (store.latest_begin (transaction) == store.latest_end ())
{
// Store was empty meaning we just created it, add the genesis block
rai::genesis genesis;
store.initialize (transaction, genesis);
}
if (!store.block_exists (transaction, genesis.hash ()))
{
BOOST_LOG (log) << "Genesis block not found. Make sure the node network ID is correct.";
std::exit (1);
}

node_id = rai::keypair (store.get_node_id (transaction));
BOOST_LOG (log) << "Node ID: " << node_id.pub.to_account ();
}
Expand Down

0 comments on commit 7fc2e4a

Please sign in to comment.