mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02: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:
parent
fa298971e6
commit
fa7a883f5a
2 changed files with 16 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue