mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-09 11:03:27 +02:00
Merge bitcoin/bitcoin#23492: test: tidy up addrman unit tests
0000edaba3
style: Use 4 spaces for indentation, not 5 (MarcoFalke)fab9264be5
test: Remove unused CDataStream copy (MarcoFalke) Pull request description: Fix two issues: * Remove unneeded code, which makes test harder to read and write * Fix wrong indentation, which breaks some editors ACKs for top commit: jnewbery: Code review ACK0000edaba3
brunoerg: cr/tACK0000edaba3
shaavan: ACK0000edaba3
Tree-SHA512: babec1dfb840bd11ec89ec3d0e2529f826f5775fc7625e987480fac5251f6a6cdcf9a1051c8364d6ca2f66ce9934dcb8447a8cf7376b3952920faf2afd02be99
This commit is contained in:
@@ -90,7 +90,8 @@ static CService ResolveService(const std::string& ip, uint16_t port = 0)
|
||||
}
|
||||
|
||||
|
||||
static std::vector<bool> FromBytes(const unsigned char* source, int vector_size) {
|
||||
static std::vector<bool> FromBytes(const unsigned char* source, int vector_size)
|
||||
{
|
||||
std::vector<bool> result(vector_size);
|
||||
for (int byte_i = 0; byte_i < vector_size / 8; ++byte_i) {
|
||||
unsigned char cur_byte = source[byte_i];
|
||||
@@ -693,7 +694,6 @@ BOOST_AUTO_TEST_CASE(caddrinfo_get_new_bucket)
|
||||
// Test: IP addresses in the different source /16 prefixes sometimes map to NO MORE
|
||||
// than 1 bucket.
|
||||
BOOST_CHECK(buckets.size() == 1);
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(addrman_serialization)
|
||||
@@ -831,7 +831,6 @@ BOOST_AUTO_TEST_CASE(addrman_selecttriedcollision)
|
||||
BOOST_CHECK(addrman.size() == 22);
|
||||
BOOST_CHECK(addrman.SelectTriedCollision().first.ToString() == "[::]:0");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(addrman_noevict)
|
||||
@@ -949,9 +948,7 @@ static CDataStream AddrmanToStream(const AddrMan& addrman)
|
||||
CDataStream ssPeersIn(SER_DISK, CLIENT_VERSION);
|
||||
ssPeersIn << Params().MessageStart();
|
||||
ssPeersIn << addrman;
|
||||
std::string str = ssPeersIn.str();
|
||||
std::vector<unsigned char> vchData(str.begin(), str.end());
|
||||
return CDataStream(vchData, SER_DISK, CLIENT_VERSION);
|
||||
return ssPeersIn;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(load_addrman)
|
||||
@@ -1023,9 +1020,7 @@ static CDataStream MakeCorruptPeersDat()
|
||||
AddrInfo info = AddrInfo(addr, resolved);
|
||||
s << info;
|
||||
|
||||
std::string str = s.str();
|
||||
std::vector<unsigned char> vchData(str.begin(), str.end());
|
||||
return CDataStream(vchData, SER_DISK, CLIENT_VERSION);
|
||||
return s;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(load_addrman_corrupted)
|
||||
|
Reference in New Issue
Block a user