Nodes no longer create a default wallet.

This commit is contained in:
clemahieu 2015-01-16 23:26:51 -06:00
commit fe48fa01ce
4 changed files with 11 additions and 16 deletions

View file

@ -17,7 +17,8 @@ TEST (node, block_store_path_failure)
rai::node_init init;
rai::processor_service processor;
auto service (boost::make_shared <boost::asio::io_service> ());
auto node (std::make_shared <rai::node> (init, service, 0, boost::filesystem::path {}, processor));
auto node (std::make_shared <rai::node> (init, service, 0, boost::filesystem::unique_path (), processor));
ASSERT_TRUE (node->wallets.items.empty ());
node->stop ();
}

View file

@ -25,6 +25,7 @@ namespace landing
{
bootstrap_peers.push_back ("rai.raiblocks.net");
rai::random_pool.GenerateBlock (wallet.bytes.begin (), wallet.bytes.size ());
assert (!wallet.is_zero ());
}
config (bool & error_a, std::istream & stream_a)
{

View file

@ -1339,12 +1339,6 @@ service (processor_a)
{
gap_cache.vote (vote_a);
});
if (wallets.items.empty ())
{
rai::uint256_union id;
rai::random_pool.GenerateBlock (id.bytes.data (), id.bytes.size ());
wallets.create (id);
}
if (log_to_cerr ())
{
boost::log::add_console_log (std::cerr);
@ -1859,6 +1853,9 @@ service (new boost::asio::io_service)
auto node (std::make_shared <rai::node> (init, service, port_a + i, processor));
assert (!init.error ());
node->start ();
rai::uint256_union wallet;
rai::random_pool.GenerateBlock (wallet.bytes.data (), wallet.bytes.size ());
node->wallets.create (wallet);
nodes.push_back (node);
}
for (auto i (nodes.begin ()), j (nodes.begin () + 1), n (nodes.end ()); j != n; ++i, ++j)

View file

@ -11,10 +11,11 @@ class qt_wallet_config
public:
qt_wallet_config () :
peering_port (rai::network::node_port),
wallet (0),
account (0)
{
rai::random_pool.GenerateBlock (wallet.bytes.data (), wallet.bytes.size ());
bootstrap_peers.push_back ("rai.raiblocks.net");
assert (!wallet.is_zero ());
}
qt_wallet_config (bool & error_a, std::istream & stream_a)
{
@ -69,12 +70,6 @@ public:
tree.add_child ("bootstrap_peers", bootstrap_peers_l);
boost::property_tree::write_json (stream_a, tree);
}
bool uninitialized ()
{
auto result (wallet.is_zero ());
assert (result == account.is_zero ());
return result;
}
std::vector <std::string> bootstrap_peers;
uint16_t peering_port;
rai::uint256_union wallet;
@ -89,9 +84,11 @@ int main (int argc, char * const * argv)
auto config_path ((working / "config.json").string ());
std::ifstream config_file;
config_file.open (config_path);
auto uninitialized (true);
if (!config_file.fail ())
{
config = qt_wallet_config (config_error, config_file);
uninitialized = false;
}
if (!config_error)
{
@ -102,9 +99,8 @@ int main (int argc, char * const * argv)
auto node (std::make_shared <rai::node> (init, service, config.peering_port, working, processor));
if (!init.error ())
{
if (config.uninitialized ())
if (uninitialized)
{
rai::random_pool.GenerateBlock (config.wallet.bytes.data (), config.wallet.bytes.size ());
auto wallet (node->wallets.create (config.wallet));
rai::keypair key;
config.account = key.pub;