mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-17 15:22:55 +02:00
wallet: Ensure that the blank wallet flag is unset after imports
This commit is contained in:
@ -755,12 +755,12 @@ bool LegacyScriptPubKeyMan::AddKeyPubKeyWithDB(WalletBatch& batch, const CKey& s
|
|||||||
RemoveWatchOnly(script);
|
RemoveWatchOnly(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_storage.UnsetBlankWalletFlag(batch);
|
||||||
if (!m_storage.HasEncryptionKeys()) {
|
if (!m_storage.HasEncryptionKeys()) {
|
||||||
return batch.WriteKey(pubkey,
|
return batch.WriteKey(pubkey,
|
||||||
secret.GetPrivKey(),
|
secret.GetPrivKey(),
|
||||||
mapKeyMetadata[pubkey.GetID()]);
|
mapKeyMetadata[pubkey.GetID()]);
|
||||||
}
|
}
|
||||||
m_storage.UnsetBlankWalletFlag(batch);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,8 +72,7 @@ class WalletBlankTest(BitcoinTestFramework):
|
|||||||
wif = bytes_to_wif(eckey.get_bytes(), eckey.is_compressed)
|
wif = bytes_to_wif(eckey.get_bytes(), eckey.is_compressed)
|
||||||
|
|
||||||
wallet.importprivkey(wif)
|
wallet.importprivkey(wif)
|
||||||
# FIXME: A bug results in blank remaining set
|
assert_equal(wallet.getwalletinfo()["blank"], False)
|
||||||
assert_equal(wallet.getwalletinfo()["blank"], True)
|
|
||||||
|
|
||||||
def test_importmulti(self):
|
def test_importmulti(self):
|
||||||
if self.options.descriptors:
|
if self.options.descriptors:
|
||||||
@ -121,8 +120,7 @@ class WalletBlankTest(BitcoinTestFramework):
|
|||||||
def_wallet.dumpwallet(wallet_dump_path)
|
def_wallet.dumpwallet(wallet_dump_path)
|
||||||
|
|
||||||
wallet.importwallet(wallet_dump_path)
|
wallet.importwallet(wallet_dump_path)
|
||||||
# FIXME: A bug results in blank remaining set
|
assert_equal(wallet.getwalletinfo()["blank"], False)
|
||||||
assert_equal(wallet.getwalletinfo()["blank"], True)
|
|
||||||
|
|
||||||
def test_encrypt_legacy(self):
|
def test_encrypt_legacy(self):
|
||||||
if self.options.descriptors:
|
if self.options.descriptors:
|
||||||
|
Reference in New Issue
Block a user