diff options
author | MarcoFalke <falke.marco@gmail.com> | 2022-02-10 18:02:05 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2022-02-25 14:16:32 +0100 |
commit | fa097d074bc1afcc2a52976796bb618f7c6a68b3 (patch) | |
tree | 568e246806387910200c45080ad7e2f75a3a7fa4 /src/addrman.cpp | |
parent | ee8c99712561bfbe823d9cd787a421b5424a75d9 (diff) | |
download | bitcoin-fa097d074bc1afcc2a52976796bb618f7c6a68b3.tar.xz |
addrman: Log too low compat value
Also remove uint8_t{} casts from values that are already of the same
type.
Diffstat (limited to 'src/addrman.cpp')
-rw-r--r-- | src/addrman.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/addrman.cpp b/src/addrman.cpp index f91a979934..2fd8143c1c 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -246,12 +246,18 @@ void AddrManImpl::Unserialize(Stream& s_) uint8_t compat; s >> compat; + if (compat < INCOMPATIBILITY_BASE) { + throw std::ios_base::failure(strprintf( + "Corrupted addrman database: The compat value (%u) " + "is lower than the expected minimum value %u.", + compat, INCOMPATIBILITY_BASE)); + } const uint8_t lowest_compatible = compat - INCOMPATIBILITY_BASE; if (lowest_compatible > FILE_FORMAT) { throw InvalidAddrManVersionError(strprintf( "Unsupported format of addrman database: %u. It is compatible with formats >=%u, " "but the maximum supported by this version of %s is %u.", - uint8_t{format}, uint8_t{lowest_compatible}, PACKAGE_NAME, uint8_t{FILE_FORMAT})); + uint8_t{format}, lowest_compatible, PACKAGE_NAME, uint8_t{FILE_FORMAT})); } s >> nKey; |