mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
manually populate nodes for test rather than leveraging ping
This commit is contained in:
parent
60f2344b2b
commit
94c1a961d9
11
net.cpp
11
net.cpp
@ -111,6 +111,8 @@ struct TestNodeTableHost: public TestHost
|
|||||||
|
|
||||||
void pingAll() { for (auto& t: nodeTables) t->pingTestNodes(testNodes); }
|
void pingAll() { for (auto& t: nodeTables) t->pingTestNodes(testNodes); }
|
||||||
|
|
||||||
|
void populateAll(size_t _count = 0) { for (auto& t: nodeTables) t->populateTestNodes(testNodes, _count); }
|
||||||
|
|
||||||
void populate(size_t _count = 0) { nodeTable->populateTestNodes(testNodes, _count); }
|
void populate(size_t _count = 0) { nodeTable->populateTestNodes(testNodes, _count); }
|
||||||
|
|
||||||
KeyPair m_alias;
|
KeyPair m_alias;
|
||||||
@ -171,22 +173,21 @@ BOOST_AUTO_TEST_CASE(test_findnode_neighbors)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(kademlia)
|
BOOST_AUTO_TEST_CASE(kademlia)
|
||||||
{
|
{
|
||||||
TestNodeTableHost node(12);
|
// Not yet a 'real' test.
|
||||||
|
TestNodeTableHost node(8);
|
||||||
node.start();
|
node.start();
|
||||||
node.nodeTable->join(); // ideally, joining with empty node table logs warning we can check for
|
node.nodeTable->join(); // ideally, joining with empty node table logs warning we can check for
|
||||||
node.setup();
|
node.setup();
|
||||||
node.populate();
|
node.populate();
|
||||||
clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
|
clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
|
||||||
|
|
||||||
node.pingAll();
|
node.populateAll();
|
||||||
this_thread::sleep_for(chrono::milliseconds(1000));
|
|
||||||
clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
|
clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
|
||||||
|
|
||||||
node.nodeTable->reset();
|
node.nodeTable->reset();
|
||||||
clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
|
clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
|
||||||
|
|
||||||
node.populate(2);
|
node.populate(1);
|
||||||
this_thread::sleep_for(chrono::milliseconds(500));
|
|
||||||
clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
|
clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
|
||||||
|
|
||||||
node.nodeTable->join();
|
node.nodeTable->join();
|
||||||
|
Loading…
Reference in New Issue
Block a user