wallet/migration: use HavePrivateKeys in place of ToPrivateString
ToPrivateString() behaviour will be modified in the following commits. In order to keep the scope of this PR limited to the RPC behaviour, this commit updates wallet migration to use 'Descriptor::HavePrivateKeys()' in place of 'Descriptor::ToPrivateString()' to determine watchonly descriptors. A follow-up PR can be opened to update migration logic to exclude descriptors with some private keys from the watchonly migration wallet.
This commit is contained in:
1 parent
e842eb90bb
commit
2dc74e3f4e
1 file changed
+3
-4
@@ -717,10 +717,9 @@ std::optional<MigrationData> LegacyDataSPKM::MigrateToDescriptor()
|
|||||||
|
|
||||||
std::vector<CScript> desc_spks;
|
std::vector<CScript> desc_spks;
|
||||||
|
|
||||||
// Make the descriptor string with private keys
|
// If we can't provide all private keys for this inferred descriptor,
|
||||||
std::string desc_str;
|
// but this wallet is not watch-only, migrate it to the watch-only wallet.
|
||||||
bool watchonly = !desc->ToPrivateString(*this, desc_str);
|
if (!desc->HavePrivateKeys(*this) && !m_storage.IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)) {
|
||||||
if (watchonly && !m_storage.IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)) {
|
|
||||||
out.watch_descs.emplace_back(desc->ToString(), creation_time);
|
out.watch_descs.emplace_back(desc->ToString(), creation_time);
|
||||||
|
|
||||||
// Get the scriptPubKeys without writing this to the wallet
|
// Get the scriptPubKeys without writing this to the wallet
|
||||||
|
|||||||
Reference in new issue
Block a user