mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
addrman: Replace assert with throw on corrupt data
Assert should only be used for program internal logic errors, not to sanitize external user input.
This commit is contained in:
@@ -386,7 +386,12 @@ void CAddrMan::Unserialize(Stream& s_)
|
||||
LogPrint(BCLog::ADDRMAN, "addrman lost %i new and %i tried addresses due to collisions or invalid addresses\n", nLostUnk, nLost);
|
||||
}
|
||||
|
||||
Check();
|
||||
const int check_code{ForceCheckAddrman()};
|
||||
if (check_code != 0) {
|
||||
throw std::ios_base::failure(strprintf(
|
||||
"Corrupt data. Consistency check failed with code %s",
|
||||
check_code));
|
||||
}
|
||||
}
|
||||
|
||||
// explicit instantiation
|
||||
|
||||
Reference in New Issue
Block a user