Renaming more client to node.
This commit is contained in:
parent
98d99dedeb
commit
55238ffe19
8 changed files with 259 additions and 259 deletions
|
@ -106,12 +106,12 @@ void rai_daemon::daemon::run (int argc, char * const * argv)
|
|||
auto pool (boost::make_shared <boost::network::utils::thread_pool> ());
|
||||
rai::processor_service processor;
|
||||
rai::node_init init;
|
||||
auto client (std::make_shared <rai::node> (init, service, config.peering_port, working, processor));
|
||||
auto node (std::make_shared <rai::node> (init, service, config.peering_port, working, processor));
|
||||
if (!init.error ())
|
||||
{
|
||||
client->bootstrap_peers = config.bootstrap_peers;
|
||||
client->start ();
|
||||
rai::rpc rpc (service, pool, config.rpc_address, config.rpc_port, *client, config.rpc_enable_control);
|
||||
node->bootstrap_peers = config.bootstrap_peers;
|
||||
node->start ();
|
||||
rai::rpc rpc (service, pool, config.rpc_address, config.rpc_port, *node, config.rpc_enable_control);
|
||||
if (config.rpc_enable)
|
||||
{
|
||||
rpc.start ();
|
||||
|
@ -143,7 +143,7 @@ void rai_daemon::daemon::run (int argc, char * const * argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error initializing client\n";
|
||||
std::cerr << "Error initializing node\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
TEST (conflicts, start_stop)
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
auto & client1 (*system.nodes [0]);
|
||||
auto & node1 (*system.nodes [0]);
|
||||
rai::genesis genesis;
|
||||
rai::send_block send1;
|
||||
rai::keypair key1;
|
||||
|
@ -12,26 +12,26 @@ TEST (conflicts, start_stop)
|
|||
send1.hashables.balance.clear ();
|
||||
send1.hashables.destination = key1.pub;
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1.hash (), send1.signature);
|
||||
ASSERT_EQ (rai::process_result::progress, client1.ledger.process (send1));
|
||||
ASSERT_EQ (0, client1.conflicts.roots.size ());
|
||||
ASSERT_TRUE (client1.conflicts.no_conflict (send1.hashables.previous));
|
||||
client1.conflicts.start (send1, false);
|
||||
ASSERT_TRUE (client1.conflicts.no_conflict (send1.hashables.previous));
|
||||
ASSERT_EQ (1, client1.conflicts.roots.size ());
|
||||
ASSERT_EQ (rai::process_result::progress, node1.ledger.process (send1));
|
||||
ASSERT_EQ (0, node1.conflicts.roots.size ());
|
||||
ASSERT_TRUE (node1.conflicts.no_conflict (send1.hashables.previous));
|
||||
node1.conflicts.start (send1, false);
|
||||
ASSERT_TRUE (node1.conflicts.no_conflict (send1.hashables.previous));
|
||||
ASSERT_EQ (1, node1.conflicts.roots.size ());
|
||||
auto root1 (send1.root ());
|
||||
auto existing1 (client1.conflicts.roots.find (root1));
|
||||
ASSERT_NE (client1.conflicts.roots.end (), existing1);
|
||||
auto existing1 (node1.conflicts.roots.find (root1));
|
||||
ASSERT_NE (node1.conflicts.roots.end (), existing1);
|
||||
auto votes1 (existing1->second);
|
||||
ASSERT_NE (nullptr, votes1);
|
||||
ASSERT_EQ (1, votes1->votes.rep_votes.size ());
|
||||
client1.conflicts.stop (root1);
|
||||
ASSERT_EQ (0, client1.conflicts.roots.size ());
|
||||
node1.conflicts.stop (root1);
|
||||
ASSERT_EQ (0, node1.conflicts.roots.size ());
|
||||
}
|
||||
|
||||
TEST (conflicts, add_existing)
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
auto & client1 (*system.nodes [0]);
|
||||
auto & node1 (*system.nodes [0]);
|
||||
rai::genesis genesis;
|
||||
rai::send_block send1;
|
||||
rai::keypair key1;
|
||||
|
@ -39,26 +39,26 @@ TEST (conflicts, add_existing)
|
|||
send1.hashables.balance.clear ();
|
||||
send1.hashables.destination = key1.pub;
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1.hash (), send1.signature);
|
||||
ASSERT_EQ (rai::process_result::progress, client1.ledger.process (send1));
|
||||
client1.conflicts.start (send1, false);
|
||||
ASSERT_EQ (rai::process_result::progress, node1.ledger.process (send1));
|
||||
node1.conflicts.start (send1, false);
|
||||
rai::send_block send2;
|
||||
rai::keypair key2;
|
||||
send2.hashables.previous = genesis.hash ();
|
||||
send2.hashables.balance.clear ();
|
||||
send2.hashables.destination = key2.pub;
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send2.hash (), send2.signature);
|
||||
client1.conflicts.start (send2, false);
|
||||
ASSERT_EQ (1, client1.conflicts.roots.size ());
|
||||
node1.conflicts.start (send2, false);
|
||||
ASSERT_EQ (1, node1.conflicts.roots.size ());
|
||||
rai::vote vote1;
|
||||
vote1.account = key2.pub;
|
||||
vote1.sequence = 0;
|
||||
vote1.block = send2.clone ();
|
||||
rai::sign_message (key2.prv, key2.pub, vote1.hash (), vote1.signature);
|
||||
ASSERT_TRUE (client1.conflicts.no_conflict (send1.hashables.previous));
|
||||
client1.conflicts.update (vote1);
|
||||
ASSERT_FALSE (client1.conflicts.no_conflict (send1.hashables.previous));
|
||||
ASSERT_EQ (1, client1.conflicts.roots.size ());
|
||||
auto votes1 (client1.conflicts.roots [send2.root ()]);
|
||||
ASSERT_TRUE (node1.conflicts.no_conflict (send1.hashables.previous));
|
||||
node1.conflicts.update (vote1);
|
||||
ASSERT_FALSE (node1.conflicts.no_conflict (send1.hashables.previous));
|
||||
ASSERT_EQ (1, node1.conflicts.roots.size ());
|
||||
auto votes1 (node1.conflicts.roots [send2.root ()]);
|
||||
ASSERT_NE (nullptr, votes1);
|
||||
ASSERT_EQ (2, votes1->votes.rep_votes.size ());
|
||||
ASSERT_NE (votes1->votes.rep_votes.end (), votes1->votes.rep_votes.find (key2.pub));
|
||||
|
@ -67,7 +67,7 @@ TEST (conflicts, add_existing)
|
|||
TEST (conflicts, add_two)
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
auto & client1 (*system.nodes [0]);
|
||||
auto & node1 (*system.nodes [0]);
|
||||
rai::genesis genesis;
|
||||
rai::send_block send1;
|
||||
rai::keypair key1;
|
||||
|
@ -75,15 +75,15 @@ TEST (conflicts, add_two)
|
|||
send1.hashables.balance.clear ();
|
||||
send1.hashables.destination = key1.pub;
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1.hash (), send1.signature);
|
||||
ASSERT_EQ (rai::process_result::progress, client1.ledger.process (send1));
|
||||
client1.conflicts.start (send1, false);
|
||||
ASSERT_EQ (rai::process_result::progress, node1.ledger.process (send1));
|
||||
node1.conflicts.start (send1, false);
|
||||
rai::send_block send2;
|
||||
rai::keypair key2;
|
||||
send2.hashables.previous = send1.hash ();
|
||||
send2.hashables.balance.clear ();
|
||||
send2.hashables.destination = key2.pub;
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send2.hash (), send2.signature);
|
||||
ASSERT_EQ (rai::process_result::progress, client1.ledger.process (send2));
|
||||
client1.conflicts.start (send2, false);
|
||||
ASSERT_EQ (2, client1.conflicts.roots.size ());
|
||||
ASSERT_EQ (rai::process_result::progress, node1.ledger.process (send2));
|
||||
node1.conflicts.start (send2, false);
|
||||
ASSERT_EQ (2, node1.conflicts.roots.size ());
|
||||
}
|
|
@ -795,7 +795,7 @@ TEST (ledegr, double_receive)
|
|||
TEST (votes, add_unsigned)
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
auto & client1 (*system.nodes [0]);
|
||||
auto & node1 (*system.nodes [0]);
|
||||
rai::genesis genesis;
|
||||
rai::send_block send1;
|
||||
rai::keypair key1;
|
||||
|
@ -803,9 +803,9 @@ TEST (votes, add_unsigned)
|
|||
send1.hashables.balance.clear ();
|
||||
send1.hashables.destination = key1.pub;
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1.hash (), send1.signature);
|
||||
ASSERT_EQ (rai::process_result::progress, client1.ledger.process (send1));
|
||||
client1.conflicts.start (send1, false);
|
||||
auto votes1 (client1.conflicts.roots.find (send1.root ())->second);
|
||||
ASSERT_EQ (rai::process_result::progress, node1.ledger.process (send1));
|
||||
node1.conflicts.start (send1, false);
|
||||
auto votes1 (node1.conflicts.roots.find (send1.root ())->second);
|
||||
ASSERT_NE (nullptr, votes1);
|
||||
ASSERT_EQ (1, votes1->votes.rep_votes.size ());
|
||||
rai::vote vote1;
|
||||
|
@ -819,7 +819,7 @@ TEST (votes, add_unsigned)
|
|||
TEST (votes, add_one)
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
auto & client1 (*system.nodes [0]);
|
||||
auto & node1 (*system.nodes [0]);
|
||||
rai::genesis genesis;
|
||||
rai::send_block send1;
|
||||
rai::keypair key1;
|
||||
|
@ -827,9 +827,9 @@ TEST (votes, add_one)
|
|||
send1.hashables.balance.clear ();
|
||||
send1.hashables.destination = key1.pub;
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1.hash (), send1.signature);
|
||||
ASSERT_EQ (rai::process_result::progress, client1.ledger.process (send1));
|
||||
client1.conflicts.start (send1, false);
|
||||
auto votes1 (client1.conflicts.roots.find (send1.root ())->second);
|
||||
ASSERT_EQ (rai::process_result::progress, node1.ledger.process (send1));
|
||||
node1.conflicts.start (send1, false);
|
||||
auto votes1 (node1.conflicts.roots.find (send1.root ())->second);
|
||||
ASSERT_EQ (1, votes1->votes.rep_votes.size ());
|
||||
rai::vote vote1;
|
||||
vote1.sequence = 1;
|
||||
|
@ -841,7 +841,7 @@ TEST (votes, add_one)
|
|||
auto existing1 (votes1->votes.rep_votes.find (rai::test_genesis_key.pub));
|
||||
ASSERT_NE (votes1->votes.rep_votes.end (), existing1);
|
||||
ASSERT_EQ (send1, *existing1->second.second);
|
||||
auto winner (client1.ledger.winner (votes1->votes));
|
||||
auto winner (node1.ledger.winner (votes1->votes));
|
||||
ASSERT_EQ (send1, *winner.second);
|
||||
ASSERT_EQ (std::numeric_limits <rai::uint128_t>::max (), winner.first);
|
||||
}
|
||||
|
@ -849,7 +849,7 @@ TEST (votes, add_one)
|
|||
TEST (votes, add_two)
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
auto & client1 (*system.nodes [0]);
|
||||
auto & node1 (*system.nodes [0]);
|
||||
rai::genesis genesis;
|
||||
rai::send_block send1;
|
||||
rai::keypair key1;
|
||||
|
@ -857,9 +857,9 @@ TEST (votes, add_two)
|
|||
send1.hashables.balance.clear ();
|
||||
send1.hashables.destination = key1.pub;
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1.hash (), send1.signature);
|
||||
ASSERT_EQ (rai::process_result::progress, client1.ledger.process (send1));
|
||||
client1.conflicts.start (send1, false);
|
||||
auto votes1 (client1.conflicts.roots.find (send1.root ())->second);
|
||||
ASSERT_EQ (rai::process_result::progress, node1.ledger.process (send1));
|
||||
node1.conflicts.start (send1, false);
|
||||
auto votes1 (node1.conflicts.roots.find (send1.root ())->second);
|
||||
rai::vote vote1;
|
||||
vote1.sequence = 1;
|
||||
vote1.block = send1.clone ();
|
||||
|
@ -883,14 +883,14 @@ TEST (votes, add_two)
|
|||
ASSERT_EQ (send1, *votes1->votes.rep_votes [rai::test_genesis_key.pub].second);
|
||||
ASSERT_NE (votes1->votes.rep_votes.end (), votes1->votes.rep_votes.find (key2.pub));
|
||||
ASSERT_EQ (send2, *votes1->votes.rep_votes [key2.pub].second);
|
||||
auto winner (client1.ledger.winner (votes1->votes));
|
||||
auto winner (node1.ledger.winner (votes1->votes));
|
||||
ASSERT_EQ (send1, *winner.second);
|
||||
}
|
||||
|
||||
TEST (votes, add_existing)
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
auto & client1 (*system.nodes [0]);
|
||||
auto & node1 (*system.nodes [0]);
|
||||
rai::genesis genesis;
|
||||
rai::send_block send1;
|
||||
rai::keypair key1;
|
||||
|
@ -898,9 +898,9 @@ TEST (votes, add_existing)
|
|||
send1.hashables.balance.clear ();
|
||||
send1.hashables.destination = key1.pub;
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1.hash (), send1.signature);
|
||||
ASSERT_EQ (rai::process_result::progress, client1.ledger.process (send1));
|
||||
client1.conflicts.start (send1, false);
|
||||
auto votes1 (client1.conflicts.roots.find (send1.root ())->second);
|
||||
ASSERT_EQ (rai::process_result::progress, node1.ledger.process (send1));
|
||||
node1.conflicts.start (send1, false);
|
||||
auto votes1 (node1.conflicts.roots.find (send1.root ())->second);
|
||||
rai::vote vote1;
|
||||
vote1.sequence = 1;
|
||||
vote1.block = send1.clone ();
|
||||
|
@ -922,14 +922,14 @@ TEST (votes, add_existing)
|
|||
ASSERT_EQ (2, votes1->votes.rep_votes.size ());
|
||||
ASSERT_NE (votes1->votes.rep_votes.end (), votes1->votes.rep_votes.find (rai::test_genesis_key.pub));
|
||||
ASSERT_EQ (send2, *votes1->votes.rep_votes [rai::test_genesis_key.pub].second);
|
||||
auto winner (client1.ledger.winner (votes1->votes));
|
||||
auto winner (node1.ledger.winner (votes1->votes));
|
||||
ASSERT_EQ (send2, *winner.second);
|
||||
}
|
||||
|
||||
TEST (votes, add_old)
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
auto & client1 (*system.nodes [0]);
|
||||
auto & node1 (*system.nodes [0]);
|
||||
rai::genesis genesis;
|
||||
rai::send_block send1;
|
||||
rai::keypair key1;
|
||||
|
@ -937,9 +937,9 @@ TEST (votes, add_old)
|
|||
send1.hashables.balance.clear ();
|
||||
send1.hashables.destination = key1.pub;
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1.hash (), send1.signature);
|
||||
ASSERT_EQ (rai::process_result::progress, client1.ledger.process (send1));
|
||||
client1.conflicts.start (send1, false);
|
||||
auto votes1 (client1.conflicts.roots.find (send1.root ())->second);
|
||||
ASSERT_EQ (rai::process_result::progress, node1.ledger.process (send1));
|
||||
node1.conflicts.start (send1, false);
|
||||
auto votes1 (node1.conflicts.roots.find (send1.root ())->second);
|
||||
rai::vote vote1;
|
||||
vote1.sequence = 2;
|
||||
vote1.block = send1.clone ();
|
||||
|
@ -961,7 +961,7 @@ TEST (votes, add_old)
|
|||
ASSERT_EQ (2, votes1->votes.rep_votes.size ());
|
||||
ASSERT_NE (votes1->votes.rep_votes.end (), votes1->votes.rep_votes.find (rai::test_genesis_key.pub));
|
||||
ASSERT_EQ (send1, *votes1->votes.rep_votes [rai::test_genesis_key.pub].second);
|
||||
auto winner (client1.ledger.winner (votes1->votes));
|
||||
auto winner (node1.ledger.winner (votes1->votes));
|
||||
ASSERT_EQ (send1, *winner.second);
|
||||
}
|
||||
|
||||
|
@ -981,11 +981,11 @@ TEST (ledger, successor)
|
|||
|
||||
TEST (fork, publish)
|
||||
{
|
||||
std::weak_ptr <rai::node> client0;
|
||||
std::weak_ptr <rai::node> node0;
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
client0 = system.nodes [0];
|
||||
auto & client1 (*system.nodes [0]);
|
||||
node0 = system.nodes [0];
|
||||
auto & node1 (*system.nodes [0]);
|
||||
system.wallet (0)->store.insert (rai::test_genesis_key.prv);
|
||||
rai::keypair key1;
|
||||
rai::genesis genesis;
|
||||
|
@ -1004,12 +1004,12 @@ TEST (fork, publish)
|
|||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send2->hash (), send2->signature);
|
||||
rai::publish publish2;
|
||||
publish2.block = std::move (send2);
|
||||
client1.processor.process_message (publish1, client1.network.endpoint ());
|
||||
ASSERT_EQ (0, client1.conflicts.roots.size ());
|
||||
client1.processor.process_message (publish2, client1.network.endpoint ());
|
||||
ASSERT_EQ (1, client1.conflicts.roots.size ());
|
||||
auto conflict1 (client1.conflicts.roots.find (publish1.block->root ()));
|
||||
ASSERT_NE (client1.conflicts.roots.end (), conflict1);
|
||||
node1.processor.process_message (publish1, node1.network.endpoint ());
|
||||
ASSERT_EQ (0, node1.conflicts.roots.size ());
|
||||
node1.processor.process_message (publish2, node1.network.endpoint ());
|
||||
ASSERT_EQ (1, node1.conflicts.roots.size ());
|
||||
auto conflict1 (node1.conflicts.roots.find (publish1.block->root ()));
|
||||
ASSERT_NE (node1.conflicts.roots.end (), conflict1);
|
||||
auto votes1 (conflict1->second);
|
||||
ASSERT_NE (nullptr, votes1);
|
||||
ASSERT_EQ (1, votes1->votes.rep_votes.size ());
|
||||
|
@ -1022,19 +1022,19 @@ TEST (fork, publish)
|
|||
auto existing1 (votes1->votes.rep_votes.find (rai::test_genesis_key.pub));
|
||||
ASSERT_NE (votes1->votes.rep_votes.end (), existing1);
|
||||
ASSERT_EQ (*publish1.block, *existing1->second.second);
|
||||
auto winner (client1.ledger.winner (votes1->votes));
|
||||
auto winner (node1.ledger.winner (votes1->votes));
|
||||
ASSERT_EQ (*publish1.block, *winner.second);
|
||||
ASSERT_EQ (std::numeric_limits <rai::uint128_t>::max (), winner.first);
|
||||
}
|
||||
ASSERT_TRUE (client0.expired ());
|
||||
ASSERT_TRUE (node0.expired ());
|
||||
}
|
||||
|
||||
TEST (ledger, fork_keep)
|
||||
{
|
||||
rai::system system (24000, 2);
|
||||
auto & client1 (*system.nodes [0]);
|
||||
auto & client2 (*system.nodes [1]);
|
||||
ASSERT_EQ (1, client1.peers.size ());
|
||||
auto & node1 (*system.nodes [0]);
|
||||
auto & node2 (*system.nodes [1]);
|
||||
ASSERT_EQ (1, node1.peers.size ());
|
||||
system.wallet (0)->store.insert (rai::test_genesis_key.prv);
|
||||
rai::keypair key1;
|
||||
rai::genesis genesis;
|
||||
|
@ -1042,7 +1042,7 @@ TEST (ledger, fork_keep)
|
|||
send1->hashables.previous = genesis.hash ();
|
||||
send1->hashables.balance.clear ();
|
||||
send1->hashables.destination = key1.pub;
|
||||
client1.work_create (*send1);
|
||||
node1.work_create (*send1);
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1->hash (), send1->signature);
|
||||
rai::publish publish1;
|
||||
publish1.block = std::move (send1);
|
||||
|
@ -1051,20 +1051,20 @@ TEST (ledger, fork_keep)
|
|||
send2->hashables.previous = genesis.hash ();
|
||||
send2->hashables.balance.clear ();
|
||||
send2->hashables.destination = key2.pub;
|
||||
client1.work_create (*send2);
|
||||
node1.work_create (*send2);
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send2->hash (), send2->signature);
|
||||
rai::publish publish2;
|
||||
publish2.block = std::move (send2);
|
||||
client1.processor.process_message (publish1, client1.network.endpoint ());
|
||||
client2.processor.process_message (publish1, client2.network.endpoint ());
|
||||
ASSERT_EQ (0, client1.conflicts.roots.size ());
|
||||
ASSERT_EQ (0, client2.conflicts.roots.size ());
|
||||
client1.processor.process_message (publish2, client1.network.endpoint ());
|
||||
client2.processor.process_message (publish2, client2.network.endpoint ());
|
||||
ASSERT_EQ (1, client1.conflicts.roots.size ());
|
||||
ASSERT_EQ (1, client2.conflicts.roots.size ());
|
||||
auto conflict (client2.conflicts.roots.find (genesis.hash ()));
|
||||
ASSERT_NE (client2.conflicts.roots.end (), conflict);
|
||||
node1.processor.process_message (publish1, node1.network.endpoint ());
|
||||
node2.processor.process_message (publish1, node2.network.endpoint ());
|
||||
ASSERT_EQ (0, node1.conflicts.roots.size ());
|
||||
ASSERT_EQ (0, node2.conflicts.roots.size ());
|
||||
node1.processor.process_message (publish2, node1.network.endpoint ());
|
||||
node2.processor.process_message (publish2, node2.network.endpoint ());
|
||||
ASSERT_EQ (1, node1.conflicts.roots.size ());
|
||||
ASSERT_EQ (1, node2.conflicts.roots.size ());
|
||||
auto conflict (node2.conflicts.roots.find (genesis.hash ()));
|
||||
ASSERT_NE (node2.conflicts.roots.end (), conflict);
|
||||
auto votes1 (conflict->second);
|
||||
ASSERT_NE (nullptr, votes1);
|
||||
ASSERT_EQ (1, votes1->votes.rep_votes.size ());
|
||||
|
@ -1078,7 +1078,7 @@ TEST (ledger, fork_keep)
|
|||
++iterations;
|
||||
ASSERT_LT (iterations, 200);
|
||||
}
|
||||
auto winner (client1.ledger.winner (votes1->votes));
|
||||
auto winner (node1.ledger.winner (votes1->votes));
|
||||
ASSERT_EQ (*publish1.block, *winner.second);
|
||||
ASSERT_EQ (std::numeric_limits <rai::uint128_t>::max (), winner.first);
|
||||
ASSERT_TRUE (system.nodes [0]->store.block_exists (publish1.block->hash ()));
|
||||
|
@ -1088,9 +1088,9 @@ TEST (ledger, fork_keep)
|
|||
TEST (ledger, fork_flip)
|
||||
{
|
||||
rai::system system (24000, 2);
|
||||
auto & client1 (*system.nodes [0]);
|
||||
auto & client2 (*system.nodes [1]);
|
||||
ASSERT_EQ (1, client1.peers.size ());
|
||||
auto & node1 (*system.nodes [0]);
|
||||
auto & node2 (*system.nodes [1]);
|
||||
ASSERT_EQ (1, node1.peers.size ());
|
||||
system.wallet (0)->store.insert (rai::test_genesis_key.prv);
|
||||
rai::keypair key1;
|
||||
rai::genesis genesis;
|
||||
|
@ -1098,7 +1098,7 @@ TEST (ledger, fork_flip)
|
|||
send1->hashables.previous = genesis.hash ();
|
||||
send1->hashables.balance.clear ();
|
||||
send1->hashables.destination = key1.pub;
|
||||
client1.work_create (*send1);
|
||||
node1.work_create (*send1);
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1->hash (), send1->signature);
|
||||
rai::publish publish1;
|
||||
publish1.block = std::move (send1);
|
||||
|
@ -1107,25 +1107,25 @@ TEST (ledger, fork_flip)
|
|||
send2->hashables.previous = genesis.hash ();
|
||||
send2->hashables.balance.clear ();
|
||||
send2->hashables.destination = key2.pub;
|
||||
client1.work_create (*send2);
|
||||
node1.work_create (*send2);
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send2->hash (), send2->signature);
|
||||
rai::publish publish2;
|
||||
publish2.block = std::move (send2);
|
||||
client1.processor.process_message (publish1, client1.network.endpoint ());
|
||||
client2.processor.process_message (publish2, client1.network.endpoint ());
|
||||
ASSERT_EQ (0, client1.conflicts.roots.size ());
|
||||
ASSERT_EQ (0, client2.conflicts.roots.size ());
|
||||
client1.processor.process_message (publish2, client1.network.endpoint ());
|
||||
client2.processor.process_message (publish1, client2.network.endpoint ());
|
||||
ASSERT_EQ (1, client1.conflicts.roots.size ());
|
||||
ASSERT_EQ (1, client2.conflicts.roots.size ());
|
||||
auto conflict (client2.conflicts.roots.find (genesis.hash ()));
|
||||
ASSERT_NE (client2.conflicts.roots.end (), conflict);
|
||||
node1.processor.process_message (publish1, node1.network.endpoint ());
|
||||
node2.processor.process_message (publish2, node1.network.endpoint ());
|
||||
ASSERT_EQ (0, node1.conflicts.roots.size ());
|
||||
ASSERT_EQ (0, node2.conflicts.roots.size ());
|
||||
node1.processor.process_message (publish2, node1.network.endpoint ());
|
||||
node2.processor.process_message (publish1, node2.network.endpoint ());
|
||||
ASSERT_EQ (1, node1.conflicts.roots.size ());
|
||||
ASSERT_EQ (1, node2.conflicts.roots.size ());
|
||||
auto conflict (node2.conflicts.roots.find (genesis.hash ()));
|
||||
ASSERT_NE (node2.conflicts.roots.end (), conflict);
|
||||
auto votes1 (conflict->second);
|
||||
ASSERT_NE (nullptr, votes1);
|
||||
ASSERT_EQ (1, votes1->votes.rep_votes.size ());
|
||||
ASSERT_TRUE (client1.store.block_exists (publish1.block->hash ()));
|
||||
ASSERT_TRUE (client2.store.block_exists (publish2.block->hash ()));
|
||||
ASSERT_TRUE (node1.store.block_exists (publish1.block->hash ()));
|
||||
ASSERT_TRUE (node2.store.block_exists (publish2.block->hash ()));
|
||||
auto iterations (0);
|
||||
while (votes1->votes.rep_votes.size () == 1)
|
||||
{
|
||||
|
@ -1134,20 +1134,20 @@ TEST (ledger, fork_flip)
|
|||
++iterations;
|
||||
ASSERT_LT (iterations, 200);
|
||||
}
|
||||
auto winner (client1.ledger.winner (votes1->votes));
|
||||
auto winner (node1.ledger.winner (votes1->votes));
|
||||
ASSERT_EQ (*publish1.block, *winner.second);
|
||||
ASSERT_EQ (std::numeric_limits <rai::uint128_t>::max (), winner.first);
|
||||
ASSERT_TRUE (client1.store.block_exists (publish1.block->hash ()));
|
||||
ASSERT_TRUE (client2.store.block_exists (publish1.block->hash ()));
|
||||
ASSERT_FALSE (client2.store.block_exists (publish2.block->hash ()));
|
||||
ASSERT_TRUE (node1.store.block_exists (publish1.block->hash ()));
|
||||
ASSERT_TRUE (node2.store.block_exists (publish1.block->hash ()));
|
||||
ASSERT_FALSE (node2.store.block_exists (publish2.block->hash ()));
|
||||
}
|
||||
|
||||
TEST (ledger, fork_multi_flip)
|
||||
{
|
||||
rai::system system (24000, 2);
|
||||
auto & client1 (*system.nodes [0]);
|
||||
auto & client2 (*system.nodes [1]);
|
||||
ASSERT_EQ (1, client1.peers.size ());
|
||||
auto & node1 (*system.nodes [0]);
|
||||
auto & node2 (*system.nodes [1]);
|
||||
ASSERT_EQ (1, node1.peers.size ());
|
||||
system.wallet (0)->store.insert (rai::test_genesis_key.prv);
|
||||
rai::keypair key1;
|
||||
rai::genesis genesis;
|
||||
|
@ -1155,7 +1155,7 @@ TEST (ledger, fork_multi_flip)
|
|||
send1->hashables.previous = genesis.hash ();
|
||||
send1->hashables.balance.clear ();
|
||||
send1->hashables.destination = key1.pub;
|
||||
client1.work_create (*send1);
|
||||
node1.work_create (*send1);
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1->hash (), send1->signature);
|
||||
rai::publish publish1;
|
||||
publish1.block = std::move (send1);
|
||||
|
@ -1164,7 +1164,7 @@ TEST (ledger, fork_multi_flip)
|
|||
send2->hashables.previous = genesis.hash ();
|
||||
send2->hashables.balance.clear ();
|
||||
send2->hashables.destination = key2.pub;
|
||||
client1.work_create (*send2);
|
||||
node1.work_create (*send2);
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send2->hash (), send2->signature);
|
||||
rai::publish publish2;
|
||||
publish2.block = std::move (send2);
|
||||
|
@ -1172,28 +1172,28 @@ TEST (ledger, fork_multi_flip)
|
|||
send3->hashables.previous = publish2.block->hash ();
|
||||
send3->hashables.balance.clear ();
|
||||
send3->hashables.destination = key2.pub;
|
||||
client1.work_create (*send3);
|
||||
node1.work_create (*send3);
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send3->hash (), send3->signature);
|
||||
rai::publish publish3;
|
||||
publish3.block = std::move (send3);
|
||||
client1.processor.process_message (publish1, client1.network.endpoint ());
|
||||
client2.processor.process_message (publish2, client2.network.endpoint ());
|
||||
client2.processor.process_message (publish3, client2.network.endpoint ());
|
||||
ASSERT_EQ (0, client1.conflicts.roots.size ());
|
||||
ASSERT_EQ (0, client2.conflicts.roots.size ());
|
||||
client1.processor.process_message (publish2, client1.network.endpoint ());
|
||||
client1.processor.process_message (publish3, client1.network.endpoint ());
|
||||
client2.processor.process_message (publish1, client2.network.endpoint ());
|
||||
ASSERT_EQ (1, client1.conflicts.roots.size ());
|
||||
ASSERT_EQ (1, client2.conflicts.roots.size ());
|
||||
auto conflict (client2.conflicts.roots.find (genesis.hash ()));
|
||||
ASSERT_NE (client2.conflicts.roots.end (), conflict);
|
||||
node1.processor.process_message (publish1, node1.network.endpoint ());
|
||||
node2.processor.process_message (publish2, node2.network.endpoint ());
|
||||
node2.processor.process_message (publish3, node2.network.endpoint ());
|
||||
ASSERT_EQ (0, node1.conflicts.roots.size ());
|
||||
ASSERT_EQ (0, node2.conflicts.roots.size ());
|
||||
node1.processor.process_message (publish2, node1.network.endpoint ());
|
||||
node1.processor.process_message (publish3, node1.network.endpoint ());
|
||||
node2.processor.process_message (publish1, node2.network.endpoint ());
|
||||
ASSERT_EQ (1, node1.conflicts.roots.size ());
|
||||
ASSERT_EQ (1, node2.conflicts.roots.size ());
|
||||
auto conflict (node2.conflicts.roots.find (genesis.hash ()));
|
||||
ASSERT_NE (node2.conflicts.roots.end (), conflict);
|
||||
auto votes1 (conflict->second);
|
||||
ASSERT_NE (nullptr, votes1);
|
||||
ASSERT_EQ (1, votes1->votes.rep_votes.size ());
|
||||
ASSERT_TRUE (client1.store.block_exists (publish1.block->hash ()));
|
||||
ASSERT_TRUE (client2.store.block_exists (publish2.block->hash ()));
|
||||
ASSERT_TRUE (client2.store.block_exists (publish3.block->hash ()));
|
||||
ASSERT_TRUE (node1.store.block_exists (publish1.block->hash ()));
|
||||
ASSERT_TRUE (node2.store.block_exists (publish2.block->hash ()));
|
||||
ASSERT_TRUE (node2.store.block_exists (publish3.block->hash ()));
|
||||
auto iterations (0);
|
||||
while (votes1->votes.rep_votes.size () == 1)
|
||||
{
|
||||
|
@ -1202,13 +1202,13 @@ TEST (ledger, fork_multi_flip)
|
|||
++iterations;
|
||||
ASSERT_LT (iterations, 200);
|
||||
}
|
||||
auto winner (client1.ledger.winner (votes1->votes));
|
||||
auto winner (node1.ledger.winner (votes1->votes));
|
||||
ASSERT_EQ (*publish1.block, *winner.second);
|
||||
ASSERT_EQ (std::numeric_limits <rai::uint128_t>::max (), winner.first);
|
||||
ASSERT_TRUE (client1.store.block_exists (publish1.block->hash ()));
|
||||
ASSERT_TRUE (client2.store.block_exists (publish1.block->hash ()));
|
||||
ASSERT_FALSE (client2.store.block_exists (publish2.block->hash ()));
|
||||
ASSERT_FALSE (client2.store.block_exists (publish3.block->hash ()));
|
||||
ASSERT_TRUE (node1.store.block_exists (publish1.block->hash ()));
|
||||
ASSERT_TRUE (node2.store.block_exists (publish1.block->hash ()));
|
||||
ASSERT_FALSE (node2.store.block_exists (publish2.block->hash ()));
|
||||
ASSERT_FALSE (node2.store.block_exists (publish3.block->hash ()));
|
||||
}
|
||||
|
||||
TEST (ledger, fail_change_old)
|
||||
|
|
|
@ -67,12 +67,12 @@ TEST (network, send_keepalive)
|
|||
auto list1 (system.nodes [0]->peers.list ());
|
||||
ASSERT_EQ (0, list1.size ());
|
||||
rai::node_init init1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
client1->start ();
|
||||
system.nodes [0]->network.send_keepalive (client1->network.endpoint ());
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
node1->start ();
|
||||
system.nodes [0]->network.send_keepalive (node1->network.endpoint ());
|
||||
auto initial (system.nodes [0]->network.keepalive_count);
|
||||
ASSERT_EQ (0, system.nodes [0]->peers.list ().size ());
|
||||
ASSERT_EQ (0, client1->peers.list ().size ());
|
||||
ASSERT_EQ (0, node1->peers.list ().size ());
|
||||
auto iterations (0);
|
||||
while (system.nodes [0]->network.keepalive_count == initial)
|
||||
{
|
||||
|
@ -81,12 +81,12 @@ TEST (network, send_keepalive)
|
|||
ASSERT_LT (iterations, 200);
|
||||
}
|
||||
auto peers1 (system.nodes [0]->peers.list ());
|
||||
auto peers2 (client1->peers.list ());
|
||||
auto peers2 (node1->peers.list ());
|
||||
ASSERT_EQ (1, peers1.size ());
|
||||
ASSERT_EQ (1, peers2.size ());
|
||||
ASSERT_NE (peers1.end (), std::find_if (peers1.begin (), peers1.end (), [&client1] (rai::peer_information const & information_a) {return information_a.endpoint == client1->network.endpoint ();}));
|
||||
ASSERT_NE (peers1.end (), std::find_if (peers1.begin (), peers1.end (), [&node1] (rai::peer_information const & information_a) {return information_a.endpoint == node1->network.endpoint ();}));
|
||||
ASSERT_NE (peers2.end (), std::find_if (peers2.begin (), peers2.end (), [&system] (rai::peer_information const & information_a) {return information_a.endpoint == system.nodes [0]->network.endpoint ();}));
|
||||
client1->stop ();
|
||||
node1->stop ();
|
||||
}
|
||||
|
||||
TEST (network, keepalive_ipv4)
|
||||
|
@ -95,9 +95,9 @@ TEST (network, keepalive_ipv4)
|
|||
auto list1 (system.nodes [0]->peers.list ());
|
||||
ASSERT_EQ (0, list1.size ());
|
||||
rai::node_init init1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
client1->start ();
|
||||
client1->send_keepalive (rai::endpoint (boost::asio::ip::address_v4::loopback (), 24000));
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
node1->start ();
|
||||
node1->send_keepalive (rai::endpoint (boost::asio::ip::address_v4::loopback (), 24000));
|
||||
auto initial (system.nodes [0]->network.keepalive_count);
|
||||
auto iterations (0);
|
||||
while (system.nodes [0]->network.keepalive_count == initial)
|
||||
|
@ -106,7 +106,7 @@ TEST (network, keepalive_ipv4)
|
|||
++iterations;
|
||||
ASSERT_LT (iterations, 200);
|
||||
}
|
||||
client1->stop ();
|
||||
node1->stop ();
|
||||
}
|
||||
|
||||
TEST (network, multi_keepalive)
|
||||
|
@ -115,12 +115,12 @@ TEST (network, multi_keepalive)
|
|||
auto list1 (system.nodes [0]->peers.list ());
|
||||
ASSERT_EQ (0, list1.size ());
|
||||
rai::node_init init1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
ASSERT_FALSE (init1.error ());
|
||||
client1->start ();
|
||||
ASSERT_EQ (0, client1->peers.size ());
|
||||
client1->network.send_keepalive (system.nodes [0]->network.endpoint ());
|
||||
ASSERT_EQ (0, client1->peers.size ());
|
||||
node1->start ();
|
||||
ASSERT_EQ (0, node1->peers.size ());
|
||||
node1->network.send_keepalive (system.nodes [0]->network.endpoint ());
|
||||
ASSERT_EQ (0, node1->peers.size ());
|
||||
ASSERT_EQ (0, system.nodes [0]->peers.size ());
|
||||
auto iterations1 (0);
|
||||
while (system.nodes [0]->peers.size () != 1)
|
||||
|
@ -130,19 +130,19 @@ TEST (network, multi_keepalive)
|
|||
ASSERT_LT (iterations1, 200);
|
||||
}
|
||||
rai::node_init init2;
|
||||
auto client2 (std::make_shared <rai::node> (init2, system.service, 24002, system.processor));
|
||||
auto node2 (std::make_shared <rai::node> (init2, system.service, 24002, system.processor));
|
||||
ASSERT_FALSE (init2.error ());
|
||||
client2->start ();
|
||||
client2->network.send_keepalive (system.nodes [0]->network.endpoint ());
|
||||
node2->start ();
|
||||
node2->network.send_keepalive (system.nodes [0]->network.endpoint ());
|
||||
auto iterations2 (0);
|
||||
while (client1->peers.size () != 2 || system.nodes [0]->peers.size () != 2 || client2->peers.size () != 2)
|
||||
while (node1->peers.size () != 2 || system.nodes [0]->peers.size () != 2 || node2->peers.size () != 2)
|
||||
{
|
||||
system.service->poll_one ();
|
||||
++iterations2;
|
||||
ASSERT_LT (iterations2, 200);
|
||||
}
|
||||
client1->stop ();
|
||||
client2->stop ();
|
||||
node1->stop ();
|
||||
node2->stop ();
|
||||
}
|
||||
|
||||
TEST (network, send_discarded_publish)
|
||||
|
@ -266,8 +266,8 @@ TEST (network, send_insufficient_work)
|
|||
rai::vectorstream stream (*bytes);
|
||||
publish.serialize (stream);
|
||||
}
|
||||
auto client (system.nodes [1]->shared ());
|
||||
system.nodes [0]->network.send_buffer (bytes->data (), bytes->size (), system.nodes [1]->network.endpoint (), [bytes, client] (boost::system::error_code const & ec, size_t size) {});
|
||||
auto node1 (system.nodes [1]->shared ());
|
||||
system.nodes [0]->network.send_buffer (bytes->data (), bytes->size (), system.nodes [1]->network.endpoint (), [bytes, node1] (boost::system::error_code const & ec, size_t size) {});
|
||||
ASSERT_EQ (0, system.nodes [0]->network.insufficient_work_count);
|
||||
auto iterations (0);
|
||||
while (system.nodes [1]->network.insufficient_work_count == 0)
|
||||
|
@ -282,39 +282,39 @@ TEST (network, send_insufficient_work)
|
|||
TEST (receivable_processor, confirm_insufficient_pos)
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
auto & client1 (*system.nodes [0]);
|
||||
auto & node1 (*system.nodes [0]);
|
||||
rai::genesis genesis;
|
||||
rai::send_block block1;
|
||||
block1.hashables.previous = genesis.hash ();
|
||||
block1.hashables.balance.clear ();
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, block1.hash (), block1.signature);
|
||||
ASSERT_EQ (rai::process_result::progress, client1.ledger.process (block1));
|
||||
client1.conflicts.start (block1, true);
|
||||
ASSERT_EQ (rai::process_result::progress, node1.ledger.process (block1));
|
||||
node1.conflicts.start (block1, true);
|
||||
rai::keypair key1;
|
||||
rai::confirm_ack con1;
|
||||
con1.vote.account = key1.pub;
|
||||
con1.vote.block = block1.clone ();
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, con1.vote.hash (), con1.vote.signature);
|
||||
client1.processor.process_message (con1, client1.network.endpoint ());
|
||||
node1.processor.process_message (con1, node1.network.endpoint ());
|
||||
}
|
||||
|
||||
TEST (receivable_processor, confirm_sufficient_pos)
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
auto & client1 (*system.nodes [0]);
|
||||
auto & node1 (*system.nodes [0]);
|
||||
rai::genesis genesis;
|
||||
rai::send_block block1;
|
||||
block1.hashables.previous = genesis.hash ();
|
||||
block1.hashables.balance.clear ();
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, block1.hash (), block1.signature);
|
||||
ASSERT_EQ (rai::process_result::progress, client1.ledger.process (block1));
|
||||
client1.conflicts.start (block1, true);
|
||||
ASSERT_EQ (rai::process_result::progress, node1.ledger.process (block1));
|
||||
node1.conflicts.start (block1, true);
|
||||
rai::keypair key1;
|
||||
rai::confirm_ack con1;
|
||||
con1.vote.account = key1.pub;
|
||||
con1.vote.block = block1.clone ();
|
||||
rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, con1.vote.hash (), con1.vote.signature);
|
||||
client1.processor.process_message (con1, client1.network.endpoint ());
|
||||
node1.processor.process_message (con1, node1.network.endpoint ());
|
||||
}
|
||||
|
||||
TEST (receivable_processor, send_with_receive)
|
||||
|
@ -520,23 +520,23 @@ TEST (bootstrap_processor, DISABLED_process_none)
|
|||
{
|
||||
rai::system system (24000, 1);
|
||||
rai::node_init init1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
ASSERT_FALSE (init1.error ());
|
||||
auto done (false);
|
||||
client1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
node1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
while (!done)
|
||||
{
|
||||
system.service->run_one ();
|
||||
}
|
||||
client1->stop ();
|
||||
node1->stop ();
|
||||
}
|
||||
|
||||
TEST (bootstrap_processor, DISABLED_process_incomplete)
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
auto client (std::make_shared <rai::bootstrap_client> (system.nodes [0]));
|
||||
auto node1 (std::make_shared <rai::bootstrap_client> (system.nodes [0]));
|
||||
rai::genesis genesis;
|
||||
auto frontier_req_client (std::make_shared <rai::frontier_req_client> (client));
|
||||
auto frontier_req_client (std::make_shared <rai::frontier_req_client> (node1));
|
||||
frontier_req_client->pulls [rai::test_genesis_key.pub] = genesis.hash ();
|
||||
auto bulk_pull_client (std::make_shared <rai::bulk_pull_client> (frontier_req_client));
|
||||
std::unique_ptr <rai::send_block> block1 (new rai::send_block);
|
||||
|
@ -549,21 +549,21 @@ TEST (bootstrap_processor, process_one)
|
|||
system.wallet (0)->store.insert (rai::test_genesis_key.prv);
|
||||
ASSERT_FALSE (system.wallet (0)->send (rai::test_genesis_key.pub, 100));
|
||||
rai::node_init init1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
auto hash1 (system.nodes [0]->ledger.latest (rai::test_genesis_key.pub));
|
||||
auto hash2 (client1->ledger.latest (rai::test_genesis_key.pub));
|
||||
auto hash2 (node1->ledger.latest (rai::test_genesis_key.pub));
|
||||
ASSERT_NE (hash1, hash2);
|
||||
client1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
node1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
auto iterations (0);
|
||||
while (client1->ledger.latest (rai::test_genesis_key.pub) != hash1)
|
||||
while (node1->ledger.latest (rai::test_genesis_key.pub) != hash1)
|
||||
{
|
||||
system.service->poll_one ();
|
||||
++iterations;
|
||||
ASSERT_LT (iterations, 200);
|
||||
}
|
||||
auto hash3 (client1->ledger.latest (rai::test_genesis_key.pub));
|
||||
auto hash3 (node1->ledger.latest (rai::test_genesis_key.pub));
|
||||
ASSERT_EQ (hash1, hash3);
|
||||
client1->stop ();
|
||||
node1->stop ();
|
||||
}
|
||||
|
||||
TEST (bootstrap_processor, process_two)
|
||||
|
@ -579,19 +579,19 @@ TEST (bootstrap_processor, process_two)
|
|||
ASSERT_NE (hash1, hash3);
|
||||
ASSERT_NE (hash2, hash3);
|
||||
rai::node_init init1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
ASSERT_FALSE (init1.error ());
|
||||
client1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
node1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
auto iterations (0);
|
||||
while (client1->ledger.latest (rai::test_genesis_key.pub) != hash3)
|
||||
while (node1->ledger.latest (rai::test_genesis_key.pub) != hash3)
|
||||
{
|
||||
system.service->run_one ();
|
||||
++iterations;
|
||||
ASSERT_LT (iterations, 200);
|
||||
}
|
||||
auto hash4 (client1->ledger.latest (rai::test_genesis_key.pub));
|
||||
auto hash4 (node1->ledger.latest (rai::test_genesis_key.pub));
|
||||
ASSERT_EQ (hash3, hash4);
|
||||
client1->stop ();
|
||||
node1->stop ();
|
||||
}
|
||||
|
||||
TEST (bootstrap_processor, process_new)
|
||||
|
@ -612,19 +612,19 @@ TEST (bootstrap_processor, process_new)
|
|||
auto balance1 (system.nodes [0]->ledger.account_balance (rai::test_genesis_key.pub));
|
||||
auto balance2 (system.nodes [0]->ledger.account_balance (key2.pub));
|
||||
rai::node_init init1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24002, system.processor));
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24002, system.processor));
|
||||
ASSERT_FALSE (init1.error ());
|
||||
client1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
node1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
auto iterations2 (0);
|
||||
while (client1->ledger.account_balance (key2.pub) != balance2)
|
||||
while (node1->ledger.account_balance (key2.pub) != balance2)
|
||||
{
|
||||
system.service->poll_one ();
|
||||
system.processor.poll_one ();
|
||||
++iterations2;
|
||||
ASSERT_LT (iterations2, 200);
|
||||
}
|
||||
ASSERT_EQ (balance1, client1->ledger.account_balance (rai::test_genesis_key.pub));
|
||||
client1->stop ();
|
||||
ASSERT_EQ (balance1, node1->ledger.account_balance (rai::test_genesis_key.pub));
|
||||
node1->stop ();
|
||||
}
|
||||
|
||||
TEST (bootstrap_processor, diamond)
|
||||
|
@ -657,19 +657,19 @@ TEST (bootstrap_processor, diamond)
|
|||
system.nodes [0]->work_create (*receive);
|
||||
ASSERT_EQ (rai::process_result::progress, system.nodes [0]->ledger.process (*receive));
|
||||
rai::node_init init1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24002, system.processor));
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24002, system.processor));
|
||||
ASSERT_FALSE (init1.error ());
|
||||
client1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
node1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
auto iterations (0);
|
||||
while (client1->ledger.account_balance (key.pub) != std::numeric_limits <rai::uint128_t>::max ())
|
||||
while (node1->ledger.account_balance (key.pub) != std::numeric_limits <rai::uint128_t>::max ())
|
||||
{
|
||||
system.service->poll_one ();
|
||||
system.processor.poll_one ();
|
||||
++iterations;
|
||||
ASSERT_LT (iterations, 200);
|
||||
}
|
||||
ASSERT_EQ (std::numeric_limits <rai::uint128_t>::max (), client1->ledger.account_balance (key.pub));
|
||||
client1->stop ();
|
||||
ASSERT_EQ (std::numeric_limits <rai::uint128_t>::max (), node1->ledger.account_balance (key.pub));
|
||||
node1->stop ();
|
||||
}
|
||||
|
||||
TEST (bootstrap_processor, push_one)
|
||||
|
@ -677,14 +677,14 @@ TEST (bootstrap_processor, push_one)
|
|||
rai::system system (24000, 1);
|
||||
rai::node_init init1;
|
||||
rai::keypair key1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
auto wallet (client1->wallets.create (rai::uint256_union ()));
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
auto wallet (node1->wallets.create (rai::uint256_union ()));
|
||||
ASSERT_NE (nullptr, wallet);
|
||||
wallet->store.insert (rai::test_genesis_key.prv);
|
||||
auto balance (client1->ledger.account_balance (rai::test_genesis_key.pub));
|
||||
auto balance (node1->ledger.account_balance (rai::test_genesis_key.pub));
|
||||
ASSERT_FALSE (wallet->send (key1.pub, 100));
|
||||
ASSERT_NE (balance, client1->ledger.account_balance (rai::test_genesis_key.pub));
|
||||
client1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
ASSERT_NE (balance, node1->ledger.account_balance (rai::test_genesis_key.pub));
|
||||
node1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
auto iterations (0);
|
||||
while (system.nodes [0]->ledger.account_balance (rai::test_genesis_key.pub) == balance)
|
||||
{
|
||||
|
@ -692,7 +692,7 @@ TEST (bootstrap_processor, push_one)
|
|||
++iterations;
|
||||
ASSERT_LT (iterations, 200);
|
||||
}
|
||||
client1->stop ();
|
||||
node1->stop ();
|
||||
}
|
||||
|
||||
TEST (frontier_req_response, destruction)
|
||||
|
@ -782,28 +782,28 @@ TEST (bulk, genesis)
|
|||
rai::system system (24000, 1);
|
||||
system.wallet (0)->store.insert (rai::test_genesis_key.prv);
|
||||
rai::node_init init1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
ASSERT_FALSE (init1.error ());
|
||||
rai::frontier frontier1;
|
||||
ASSERT_FALSE (system.nodes [0]->store.latest_get (rai::test_genesis_key.pub, frontier1));
|
||||
rai::frontier frontier2;
|
||||
ASSERT_FALSE (client1->store.latest_get (rai::test_genesis_key.pub, frontier2));
|
||||
ASSERT_FALSE (node1->store.latest_get (rai::test_genesis_key.pub, frontier2));
|
||||
ASSERT_EQ (frontier1.hash, frontier2.hash);
|
||||
rai::keypair key2;
|
||||
ASSERT_FALSE (system.wallet (0)->send (key2.pub, 100));
|
||||
rai::frontier frontier3;
|
||||
ASSERT_FALSE (system.nodes [0]->store.latest_get (rai::test_genesis_key.pub, frontier3));
|
||||
ASSERT_NE (frontier1.hash, frontier3.hash);
|
||||
client1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
node1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
auto iterations (0);
|
||||
while (client1->ledger.latest (rai::test_genesis_key.pub) != system.nodes [0]->ledger.latest (rai::test_genesis_key.pub))
|
||||
while (node1->ledger.latest (rai::test_genesis_key.pub) != system.nodes [0]->ledger.latest (rai::test_genesis_key.pub))
|
||||
{
|
||||
system.service->poll_one ();
|
||||
++iterations;
|
||||
ASSERT_LT (iterations, 200);
|
||||
}
|
||||
ASSERT_EQ (system.nodes [0]->ledger.latest (rai::test_genesis_key.pub), client1->ledger.latest (rai::test_genesis_key.pub));
|
||||
client1->stop ();
|
||||
ASSERT_EQ (system.nodes [0]->ledger.latest (rai::test_genesis_key.pub), node1->ledger.latest (rai::test_genesis_key.pub));
|
||||
node1->stop ();
|
||||
}
|
||||
|
||||
TEST (bulk, offline_send)
|
||||
|
@ -811,10 +811,10 @@ TEST (bulk, offline_send)
|
|||
rai::system system (24000, 1);
|
||||
system.wallet (0)->store.insert (rai::test_genesis_key.prv);
|
||||
rai::node_init init1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
ASSERT_FALSE (init1.error ());
|
||||
client1->network.send_keepalive (system.nodes [0]->network.endpoint ());
|
||||
client1->start ();
|
||||
node1->network.send_keepalive (system.nodes [0]->network.endpoint ());
|
||||
node1->start ();
|
||||
auto iterations (0);
|
||||
do
|
||||
{
|
||||
|
@ -822,22 +822,22 @@ TEST (bulk, offline_send)
|
|||
system.processor.poll_one ();
|
||||
++iterations;
|
||||
ASSERT_LT (iterations, 200);
|
||||
} while (system.nodes [0]->peers.empty () || client1->peers.empty ());
|
||||
} while (system.nodes [0]->peers.empty () || node1->peers.empty ());
|
||||
rai::keypair key2;
|
||||
auto wallet (client1->wallets.create (rai::uint256_union ()));
|
||||
auto wallet (node1->wallets.create (rai::uint256_union ()));
|
||||
wallet->store.insert (key2.prv);
|
||||
ASSERT_FALSE (system.wallet (0)->send (key2.pub, 100));
|
||||
ASSERT_NE (std::numeric_limits <rai::uint256_t>::max (), system.nodes [0]->ledger.account_balance (rai::test_genesis_key.pub));
|
||||
client1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
node1->processor.bootstrap (system.nodes [0]->bootstrap.endpoint ());
|
||||
auto iterations2 (0);
|
||||
while (client1->ledger.account_balance (key2.pub) != 100)
|
||||
while (node1->ledger.account_balance (key2.pub) != 100)
|
||||
{
|
||||
system.service->poll_one ();
|
||||
system.processor.poll_one ();
|
||||
++iterations2;
|
||||
ASSERT_LT (iterations2, 200);
|
||||
} ;
|
||||
client1->stop ();
|
||||
node1->stop ();
|
||||
}
|
||||
|
||||
TEST (network, ipv6)
|
||||
|
|
|
@ -175,12 +175,12 @@ TEST (node, auto_bootstrap)
|
|||
ASSERT_LT (iterations1, 200);
|
||||
} while (system.nodes [0]->ledger.account_balance (key2.pub) != 100);
|
||||
rai::node_init init1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
ASSERT_FALSE (init1.error ());
|
||||
client1->network.send_keepalive (system.nodes [0]->network.endpoint ());
|
||||
client1->start ();
|
||||
ASSERT_FALSE (client1->bootstrap_initiator.warmed_up);
|
||||
ASSERT_FALSE (client1->bootstrap_initiator.in_progress);
|
||||
node1->network.send_keepalive (system.nodes [0]->network.endpoint ());
|
||||
node1->start ();
|
||||
ASSERT_FALSE (node1->bootstrap_initiator.warmed_up);
|
||||
ASSERT_FALSE (node1->bootstrap_initiator.in_progress);
|
||||
ASSERT_FALSE (system.nodes [0]->bootstrap_initiator.warmed_up);
|
||||
ASSERT_FALSE (system.nodes [0]->bootstrap_initiator.in_progress);
|
||||
auto iterations2 (0);
|
||||
|
@ -190,8 +190,8 @@ TEST (node, auto_bootstrap)
|
|||
system.processor.poll_one ();
|
||||
++iterations2;
|
||||
ASSERT_LT (iterations2, 200);
|
||||
} while (!client1->bootstrap_initiator.in_progress || !system.nodes [0]->bootstrap_initiator.in_progress);
|
||||
ASSERT_TRUE (client1->bootstrap_initiator.warmed_up);
|
||||
} while (!node1->bootstrap_initiator.in_progress || !system.nodes [0]->bootstrap_initiator.in_progress);
|
||||
ASSERT_TRUE (node1->bootstrap_initiator.warmed_up);
|
||||
ASSERT_TRUE (system.nodes [0]->bootstrap_initiator.warmed_up);
|
||||
auto iterations3 (0);
|
||||
do
|
||||
|
@ -200,7 +200,7 @@ TEST (node, auto_bootstrap)
|
|||
system.processor.poll_one ();
|
||||
++iterations3;
|
||||
ASSERT_LT (iterations3, 200);
|
||||
} while (client1->ledger.account_balance (key2.pub) != 100);
|
||||
} while (node1->ledger.account_balance (key2.pub) != 100);
|
||||
auto iterations4 (0);
|
||||
do
|
||||
{
|
||||
|
@ -208,8 +208,8 @@ TEST (node, auto_bootstrap)
|
|||
system.processor.poll_one ();
|
||||
++iterations4;
|
||||
ASSERT_LT (iterations4, 200);
|
||||
} while (client1->bootstrap_initiator.in_progress || system.nodes [0]->bootstrap_initiator.in_progress);
|
||||
client1->stop ();
|
||||
} while (node1->bootstrap_initiator.in_progress || system.nodes [0]->bootstrap_initiator.in_progress);
|
||||
node1->stop ();
|
||||
}
|
||||
|
||||
TEST (node, auto_bootstrap_reverse)
|
||||
|
@ -217,13 +217,13 @@ TEST (node, auto_bootstrap_reverse)
|
|||
rai::system system (24000, 1);
|
||||
system.wallet (0)->store.insert (rai::test_genesis_key.prv);
|
||||
rai::node_init init1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
ASSERT_FALSE (init1.error ());
|
||||
rai::keypair key2;
|
||||
system.wallet (0)->store.insert (key2.prv);
|
||||
ASSERT_FALSE (system.wallet (0)->send (key2.pub, 100));
|
||||
system.nodes [0]->network.send_keepalive (client1->network.endpoint ());
|
||||
client1->start ();
|
||||
system.nodes [0]->network.send_keepalive (node1->network.endpoint ());
|
||||
node1->start ();
|
||||
auto iterations (0);
|
||||
do
|
||||
{
|
||||
|
@ -231,8 +231,8 @@ TEST (node, auto_bootstrap_reverse)
|
|||
system.processor.poll_one ();
|
||||
++iterations;
|
||||
ASSERT_LT (iterations, 200);
|
||||
} while (client1->ledger.account_balance (key2.pub) != 100);
|
||||
client1->stop ();
|
||||
} while (node1->ledger.account_balance (key2.pub) != 100);
|
||||
node1->stop ();
|
||||
}
|
||||
|
||||
TEST (node, multi_account_send_atomicness)
|
||||
|
@ -248,13 +248,13 @@ TEST (node, multi_account_send_atomicness)
|
|||
TEST (node, receive_gap)
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
auto & client (*system.nodes [0]);
|
||||
ASSERT_EQ (0, client.gap_cache.blocks.size ());
|
||||
auto & node1 (*system.nodes [0]);
|
||||
ASSERT_EQ (0, node1.gap_cache.blocks.size ());
|
||||
rai::send_block block;
|
||||
rai::confirm_req message;
|
||||
message.block = block.clone ();
|
||||
client.processor.process_message (message, client.network.endpoint ());
|
||||
ASSERT_EQ (1, client.gap_cache.blocks.size ());
|
||||
node1.processor.process_message (message, node1.network.endpoint ());
|
||||
ASSERT_EQ (1, node1.gap_cache.blocks.size ());
|
||||
}
|
||||
|
||||
TEST (node, scaling)
|
||||
|
@ -318,9 +318,9 @@ TEST (node, connect_after_junk)
|
|||
{
|
||||
rai::system system (24000, 1);
|
||||
rai::node_init init1;
|
||||
auto client1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
auto node1 (std::make_shared <rai::node> (init1, system.service, 24001, system.processor));
|
||||
uint64_t junk;
|
||||
client1->network.socket.async_send_to (boost::asio::buffer (&junk, sizeof (junk)), system.nodes [0]->network.endpoint (), [] (boost::system::error_code const &, size_t) {});
|
||||
node1->network.socket.async_send_to (boost::asio::buffer (&junk, sizeof (junk)), system.nodes [0]->network.endpoint (), [] (boost::system::error_code const &, size_t) {});
|
||||
auto iterations1 (0);
|
||||
while (system.nodes [0]->network.error_count == 0)
|
||||
{
|
||||
|
@ -329,14 +329,14 @@ TEST (node, connect_after_junk)
|
|||
++iterations1;
|
||||
ASSERT_LT (iterations1, 200);
|
||||
}
|
||||
client1->start ();
|
||||
client1->network.send_keepalive (system.nodes [0]->network.endpoint ());
|
||||
node1->start ();
|
||||
node1->network.send_keepalive (system.nodes [0]->network.endpoint ());
|
||||
auto iterations2 (0);
|
||||
while (client1->peers.empty ())
|
||||
while (node1->peers.empty ())
|
||||
{
|
||||
system.service->poll_one ();
|
||||
++iterations2;
|
||||
ASSERT_LT (iterations2, 200);
|
||||
}
|
||||
client1->stop ();
|
||||
node1->stop ();
|
||||
}
|
|
@ -184,11 +184,11 @@ int main (int argc, char * const * argv)
|
|||
rai::node_init init;
|
||||
auto service (boost::make_shared <boost::asio::io_service> ());
|
||||
rai::processor_service processor;
|
||||
auto client (std::make_shared <rai::node> (init, service, config.peering_port, working, processor));
|
||||
auto node (std::make_shared <rai::node> (init, service, config.peering_port, working, processor));
|
||||
if (!init.error ())
|
||||
{
|
||||
client->bootstrap_peers = config.bootstrap_peers;
|
||||
client->start ();
|
||||
node->bootstrap_peers = config.bootstrap_peers;
|
||||
node->start ();
|
||||
std::thread network_thread ([&service] ()
|
||||
{
|
||||
try
|
||||
|
@ -220,10 +220,10 @@ int main (int argc, char * const * argv)
|
|||
{
|
||||
std::cout << boost::str (boost::format ("Distribution will begin in %1% minutes\n") % (config.last - now));
|
||||
}
|
||||
auto wallet (client->wallets.open (config.wallet));
|
||||
auto wallet (node->wallets.open (config.wallet));
|
||||
if (wallet == nullptr)
|
||||
{
|
||||
wallet = client->wallets.create (config.wallet);
|
||||
wallet = node->wallets.create (config.wallet);
|
||||
}
|
||||
auto wallet_entry (wallet->store.begin ());
|
||||
if (wallet_entry == wallet->store.end ())
|
||||
|
@ -241,13 +241,13 @@ int main (int argc, char * const * argv)
|
|||
std::cout << "Type a line to start\n";
|
||||
std::string line;
|
||||
std::cin >> line;
|
||||
rai::landing::distribute (*client, wallet, config, working);
|
||||
rai::landing::distribute (*node, wallet, config, working);
|
||||
network_thread.join ();
|
||||
processor_thread.join ();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error initializing client\n";
|
||||
std::cerr << "Error initializing node\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
26
rai/node.cpp
26
rai/node.cpp
|
@ -43,7 +43,7 @@ namespace
|
|||
{
|
||||
return network_logging () && false;
|
||||
}
|
||||
bool constexpr client_lifetime_tracing ()
|
||||
bool constexpr node_lifetime_tracing ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -265,14 +265,14 @@ void rai::network::send_keepalive (rai::endpoint const & endpoint_a)
|
|||
{
|
||||
BOOST_LOG (node.log) << boost::str (boost::format ("Keepalive req sent from %1% to %2%") % endpoint () % endpoint_a);
|
||||
}
|
||||
auto client_l (node.shared ());
|
||||
send_buffer (bytes->data (), bytes->size (), endpoint_a, [bytes, client_l, endpoint_a] (boost::system::error_code const & ec, size_t)
|
||||
auto node_l (node.shared ());
|
||||
send_buffer (bytes->data (), bytes->size (), endpoint_a, [bytes, node_l, endpoint_a] (boost::system::error_code const & ec, size_t)
|
||||
{
|
||||
if (network_logging ())
|
||||
{
|
||||
if (ec)
|
||||
{
|
||||
BOOST_LOG (client_l->log) << boost::str (boost::format ("Error sending keepalive from %1% to %2% %3%") % client_l->network.endpoint () % endpoint_a % ec.message ());
|
||||
BOOST_LOG (node_l->log) << boost::str (boost::format ("Error sending keepalive from %1% to %2% %3%") % node_l->network.endpoint () % endpoint_a % ec.message ());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -326,14 +326,14 @@ void rai::network::send_confirm_req (boost::asio::ip::udp::endpoint const & endp
|
|||
{
|
||||
BOOST_LOG (node.log) << boost::str (boost::format ("Sending confirm req to %1%") % endpoint_a);
|
||||
}
|
||||
auto client_l (node.shared ());
|
||||
send_buffer (bytes->data (), bytes->size (), endpoint_a, [bytes, client_l] (boost::system::error_code const & ec, size_t size)
|
||||
auto node_l (node.shared ());
|
||||
send_buffer (bytes->data (), bytes->size (), endpoint_a, [bytes, node_l] (boost::system::error_code const & ec, size_t size)
|
||||
{
|
||||
if (network_logging ())
|
||||
{
|
||||
if (ec)
|
||||
{
|
||||
BOOST_LOG (client_l->log) << boost::str (boost::format ("Error sending confirm request: %1%") % ec.message ());
|
||||
BOOST_LOG (node_l->log) << boost::str (boost::format ("Error sending confirm request: %1%") % ec.message ());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1249,7 +1249,7 @@ service (processor_a)
|
|||
}
|
||||
boost::log::add_common_attributes ();
|
||||
boost::log::add_file_log (boost::log::keywords::target = application_path_a / "log", boost::log::keywords::file_name = application_path_a / "log" / "log_%Y-%m-%d_%H-%M-%S.%N.log", boost::log::keywords::rotation_size = 4 * 1024 * 1024, boost::log::keywords::auto_flush = rai::rai_network != rai::rai_networks::rai_test_network, boost::log::keywords::scan_method = boost::log::sinks::file::scan_method::scan_matching, boost::log::keywords::max_size = 16 * 1024 * 1024, boost::log::keywords::format = "[%TimeStamp%]: %Message%");
|
||||
BOOST_LOG (log) << "Client starting, version: " << RAIBLOCKS_VERSION_MAJOR << "." << RAIBLOCKS_VERSION_MINOR << "." << RAIBLOCKS_VERSION_PATCH;
|
||||
BOOST_LOG (log) << "Node starting, version: " << RAIBLOCKS_VERSION_MAJOR << "." << RAIBLOCKS_VERSION_MINOR << "." << RAIBLOCKS_VERSION_PATCH;
|
||||
ledger.send_observer = [this] (rai::send_block const & block_a, rai::account const & account_a, rai::amount const & balance_a)
|
||||
{
|
||||
for (auto & i: send_observers)
|
||||
|
@ -1311,9 +1311,9 @@ service (processor_a)
|
|||
});
|
||||
if (!init_a.error ())
|
||||
{
|
||||
if (client_lifetime_tracing ())
|
||||
if (node_lifetime_tracing ())
|
||||
{
|
||||
std::cerr << "Constructing client\n";
|
||||
std::cerr << "Constructing node\n";
|
||||
}
|
||||
if (store.latest_begin () == store.latest_end ())
|
||||
{
|
||||
|
@ -1331,9 +1331,9 @@ node (init_a, service_a, port_a, boost::filesystem::unique_path (), processor_a)
|
|||
|
||||
rai::node::~node ()
|
||||
{
|
||||
if (client_lifetime_tracing ())
|
||||
if (node_lifetime_tracing ())
|
||||
{
|
||||
std::cerr << "Destructing client\n";
|
||||
std::cerr << "Destructing node\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2751,7 +2751,7 @@ void rai::node::start ()
|
|||
|
||||
void rai::node::stop ()
|
||||
{
|
||||
BOOST_LOG (log) << "Client stopping";
|
||||
BOOST_LOG (log) << "Node stopping";
|
||||
network.stop ();
|
||||
bootstrap.stop ();
|
||||
service.stop ();
|
||||
|
|
|
@ -96,16 +96,16 @@ int main (int argc, char * const * argv)
|
|||
auto service (boost::make_shared <boost::asio::io_service> ());
|
||||
rai::processor_service processor;
|
||||
rai::node_init init;
|
||||
auto client (std::make_shared <rai::node> (init, service, config.peering_port, working, processor));
|
||||
auto node (std::make_shared <rai::node> (init, service, config.peering_port, working, processor));
|
||||
QObject::connect (&application, &QApplication::aboutToQuit, [&] ()
|
||||
{
|
||||
client->stop ();
|
||||
node->stop ();
|
||||
});
|
||||
if (!init.error ())
|
||||
{
|
||||
client->bootstrap_peers = config.bootstrap_peers;
|
||||
client->start ();
|
||||
std::unique_ptr <rai_qt::client> gui (new rai_qt::client (application, *client, config.wallet));
|
||||
node->bootstrap_peers = config.bootstrap_peers;
|
||||
node->start ();
|
||||
std::unique_ptr <rai_qt::client> gui (new rai_qt::client (application, *node, config.wallet));
|
||||
gui->client_window->show ();
|
||||
std::thread network_thread ([&service] ()
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ int main (int argc, char * const * argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error initializing client\n";
|
||||
std::cerr << "Error initializing node\n";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue