mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
[tests] Remove CAddrMan.Clear() call from CAddrDB::Read()
`bool CAddrDB::Read(CAddrMan& addr, CDataStream& ssPeers)` is _only_ called from the tests, and the call to addr.Clear() only exists so that a test that Clear() is called passes. Remove that test and the call.
This commit is contained in:
parent
e8e7392311
commit
ed9ba8af08
2 changed files with 2 additions and 8 deletions
|
@ -244,12 +244,7 @@ bool CAddrDB::Read(CAddrMan& addr)
|
|||
|
||||
bool CAddrDB::Read(CAddrMan& addr, CDataStream& ssPeers)
|
||||
{
|
||||
bool ret = DeserializeDB(ssPeers, addr, false);
|
||||
if (!ret) {
|
||||
// Ensure addrman is left in a clean state
|
||||
addr.Clear();
|
||||
}
|
||||
return ret;
|
||||
return DeserializeDB(ssPeers, addr, false);
|
||||
}
|
||||
|
||||
void DumpAnchors(const fs::path& anchors_db_path, const std::vector<CAddress>& anchors)
|
||||
|
|
|
@ -1083,13 +1083,12 @@ BOOST_AUTO_TEST_CASE(caddrdb_read_corrupted)
|
|||
BOOST_CHECK(addrman1.size() == 1);
|
||||
BOOST_CHECK(exceptionThrown);
|
||||
|
||||
// Test that CAddrDB::Read leaves addrman in a clean state if de-serialization fails.
|
||||
// Test that CAddrDB::Read fails if peers.dat is corrupt
|
||||
CDataStream ssPeers2 = AddrmanToStream(addrmanCorrupted);
|
||||
|
||||
CAddrMan addrman2(/* deterministic */ false, /* consistency_check_ratio */ 100);
|
||||
BOOST_CHECK(addrman2.size() == 0);
|
||||
BOOST_CHECK(!CAddrDB::Read(addrman2, ssPeers2));
|
||||
BOOST_CHECK(addrman2.size() == 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue