mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
code review
This commit is contained in:
parent
b4ca2a8b97
commit
682c68842c
12
net.cpp
12
net.cpp
@ -134,16 +134,16 @@ public:
|
|||||||
bool success = false;
|
bool success = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(test_neighbors_packet)
|
BOOST_AUTO_TEST_CASE(test_neighbours_packet)
|
||||||
{
|
{
|
||||||
KeyPair k = KeyPair::create();
|
KeyPair k = KeyPair::create();
|
||||||
std::vector<std::pair<KeyPair,unsigned>> testNodes(TestNodeTable::createTestNodes(16));
|
std::vector<std::pair<KeyPair,unsigned>> testNodes(TestNodeTable::createTestNodes(16));
|
||||||
bi::udp::endpoint to(boost::asio::ip::address::from_string("127.0.0.1"), 30000);
|
bi::udp::endpoint to(boost::asio::ip::address::from_string("127.0.0.1"), 30000);
|
||||||
|
|
||||||
Neighbors out(to);
|
Neighbours out(to);
|
||||||
for (auto n: testNodes)
|
for (auto n: testNodes)
|
||||||
{
|
{
|
||||||
Neighbors::Node node;
|
Neighbours::Node node;
|
||||||
node.ipAddress = boost::asio::ip::address::from_string("127.0.0.1").to_string();
|
node.ipAddress = boost::asio::ip::address::from_string("127.0.0.1").to_string();
|
||||||
node.port = n.second;
|
node.port = n.second;
|
||||||
node.node = n.first.pub();
|
node.node = n.first.pub();
|
||||||
@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE(test_neighbors_packet)
|
|||||||
|
|
||||||
bytesConstRef packet(out.data.data(), out.data.size());
|
bytesConstRef packet(out.data.data(), out.data.size());
|
||||||
bytesConstRef rlpBytes(packet.cropped(97, packet.size() - 97));
|
bytesConstRef rlpBytes(packet.cropped(97, packet.size() - 97));
|
||||||
Neighbors in = Neighbors::fromBytesConstRef(to, rlpBytes);
|
Neighbours in = Neighbours::fromBytesConstRef(to, rlpBytes);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (auto n: in.nodes)
|
for (auto n: in.nodes)
|
||||||
{
|
{
|
||||||
@ -164,10 +164,10 @@ BOOST_AUTO_TEST_CASE(test_neighbors_packet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(test_findnode_neighbors)
|
BOOST_AUTO_TEST_CASE(test_findnode_neighbours)
|
||||||
{
|
{
|
||||||
// Executing findNode should result in a list which is serialized
|
// Executing findNode should result in a list which is serialized
|
||||||
// into Neighbors packet. Neighbors packet should then be deserialized
|
// into Neighbours packet. Neighbours packet should then be deserialized
|
||||||
// into the same list of nearest nodes.
|
// into the same list of nearest nodes.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user