0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-05 14:06:27 -05:00

wallet: Ensure that the blank wallet flag is unset after imports

This commit is contained in:
Andrew Chow 2022-07-18 13:31:19 -04:00 committed by Andrew Chow
parent e9379f1ffa
commit 43310200dc
2 changed files with 3 additions and 5 deletions

View file

@ -755,12 +755,12 @@ bool LegacyScriptPubKeyMan::AddKeyPubKeyWithDB(WalletBatch& batch, const CKey& s
RemoveWatchOnly(script);
}
m_storage.UnsetBlankWalletFlag(batch);
if (!m_storage.HasEncryptionKeys()) {
return batch.WriteKey(pubkey,
secret.GetPrivKey(),
mapKeyMetadata[pubkey.GetID()]);
}
m_storage.UnsetBlankWalletFlag(batch);
return true;
}

View file

@ -72,8 +72,7 @@ class WalletBlankTest(BitcoinTestFramework):
wif = bytes_to_wif(eckey.get_bytes(), eckey.is_compressed)
wallet.importprivkey(wif)
# FIXME: A bug results in blank remaining set
assert_equal(wallet.getwalletinfo()["blank"], True)
assert_equal(wallet.getwalletinfo()["blank"], False)
def test_importmulti(self):
if self.options.descriptors:
@ -121,8 +120,7 @@ class WalletBlankTest(BitcoinTestFramework):
def_wallet.dumpwallet(wallet_dump_path)
wallet.importwallet(wallet_dump_path)
# FIXME: A bug results in blank remaining set
assert_equal(wallet.getwalletinfo()["blank"], True)
assert_equal(wallet.getwalletinfo()["blank"], False)
def test_encrypt_legacy(self):
if self.options.descriptors: