instantsend: make sure islocks we read from db are the ones we expected (#4663)

fallback to the legacy version and then to nullptr
This commit is contained in:
UdjinM6 2022-01-20 19:25:01 +03:00 committed by GitHub
parent 4f3c2492eb
commit aa1165b697
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -326,10 +326,10 @@ CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByHash(const uint256& hash
ret = std::make_shared<CInstantSendLock>(CInstantSendLock::isdlock_version); ret = std::make_shared<CInstantSendLock>(CInstantSendLock::isdlock_version);
bool exists = db->Read(std::make_tuple(DB_ISLOCK_BY_HASH, hash), *ret); bool exists = db->Read(std::make_tuple(DB_ISLOCK_BY_HASH, hash), *ret);
if (!exists) { if (!exists || (::SerializeHash(*ret) != hash)) {
ret = std::make_shared<CInstantSendLock>(); ret = std::make_shared<CInstantSendLock>();
exists = db->Read(std::make_tuple(DB_ISLOCK_BY_HASH, hash), *ret); exists = db->Read(std::make_tuple(DB_ISLOCK_BY_HASH, hash), *ret);
if (!exists) { if (!exists || (::SerializeHash(*ret) != hash)) {
ret = nullptr; ret = nullptr;
} }
} }