From 349ed2a0eed3aaaf199ead93057c97730869c3a3 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Tue, 8 Nov 2022 01:03:07 +0100 Subject: wallet: throw error if legacy entries are present on loading descriptor wallets In the wallet key-value-loading routine, most legacy type entries require a LegacyScriptPubKeyMan instance after successful deserialization. On a descriptor wallet, creating that (via method `GetOrCreateLegacyScriptPubKeyMan`) fails and then leads to a null-pointer dereference crash. Fix this by throwing an error if if the wallet flags indicate that we have a descriptor wallet and there is a legacy entry found. --- src/wallet/walletdb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/wallet/walletdb.h') diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h index da6efe534b..27b5dbdd96 100644 --- a/src/wallet/walletdb.h +++ b/src/wallet/walletdb.h @@ -52,7 +52,8 @@ enum class DBErrors LOAD_FAIL, NEED_REWRITE, NEED_RESCAN, - UNKNOWN_DESCRIPTOR + UNKNOWN_DESCRIPTOR, + UNEXPECTED_LEGACY_ENTRY }; namespace DBKeys { -- cgit v1.2.3