wallet, refactor: Decouple into HasLegacyRecords()
The new helper will be used to fix a crash in the wallet migration process (watch-only, non-blank, private keys disabled, empty wallet - no scripts or addresses imported). Co-authored-by: Matias Furszyfer <mfurszy@protonmail.com>
This commit is contained in:
1 parent
639279e86a
commit
42c13141b5
3 files changed
+39
-17
No files matched your search
@@ -47,11 +47,14 @@ BOOST_AUTO_TEST_CASE(walletdb_read_write_deadlock)
|
||||
// Create legacy spkm
|
||||
LOCK(wallet->cs_wallet);
|
||||
auto legacy_spkm = wallet->GetOrCreateLegacyScriptPubKeyMan();
|
||||
BOOST_CHECK(!HasLegacyRecords(*wallet));
|
||||
BOOST_CHECK(legacy_spkm->SetupGeneration(true));
|
||||
BOOST_CHECK(HasLegacyRecords(*wallet));
|
||||
wallet->Flush();
|
||||
|
||||
// Now delete all records, which performs a read write operation.
|
||||
BOOST_CHECK(wallet->GetLegacyScriptPubKeyMan()->DeleteRecords());
|
||||
BOOST_CHECK(!HasLegacyRecords(*wallet));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user