diff options
author | Andrew Chow <achow101-github@achow101.com> | 2020-10-29 17:52:50 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2020-10-29 17:55:13 -0400 |
commit | bd93fc9945bfd4be117990c5d861f61ddd451f96 (patch) | |
tree | 28fb70605d9973e1be108de0d4ee22c26d566df7 /src | |
parent | 42b66a6b814bca130a9ccf0a3f747cf33d628232 (diff) | |
download | bitcoin-bd93fc9945bfd4be117990c5d861f61ddd451f96.tar.xz |
Fix change detection of imported internal descriptors
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/rpcdump.cpp | 2 | ||||
-rw-r--r-- | src/wallet/wallet.cpp | 4 | ||||
-rw-r--r-- | src/wallet/wallet.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 884ab58497..17bdc06c78 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -1559,7 +1559,7 @@ static UniValue ProcessDescriptorImport(CWallet * const pwallet, const UniValue& } // Add descriptor to the wallet - auto spk_manager = pwallet->AddWalletDescriptor(w_desc, keys, label); + auto spk_manager = pwallet->AddWalletDescriptor(w_desc, keys, label, internal); if (spk_manager == nullptr) { throw JSONRPCError(RPC_WALLET_ERROR, strprintf("Could not add descriptor '%s'", descriptor)); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 6b7d05fdf3..1a30f01027 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4510,7 +4510,7 @@ DescriptorScriptPubKeyMan* CWallet::GetDescriptorScriptPubKeyMan(const WalletDes return nullptr; } -ScriptPubKeyMan* CWallet::AddWalletDescriptor(WalletDescriptor& desc, const FlatSigningProvider& signing_provider, const std::string& label) +ScriptPubKeyMan* CWallet::AddWalletDescriptor(WalletDescriptor& desc, const FlatSigningProvider& signing_provider, const std::string& label, bool internal) { if (!IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) { WalletLogPrintf("Cannot add WalletDescriptor to a non-descriptor wallet\n"); @@ -4567,7 +4567,7 @@ ScriptPubKeyMan* CWallet::AddWalletDescriptor(WalletDescriptor& desc, const Flat } CTxDestination dest; - if (ExtractDestination(script_pub_keys.at(0), dest)) { + if (!internal && ExtractDestination(script_pub_keys.at(0), dest)) { SetAddressBook(dest, label, "receive"); } } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 74de55dcb5..00e0e3c84d 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1280,7 +1280,7 @@ public: DescriptorScriptPubKeyMan* GetDescriptorScriptPubKeyMan(const WalletDescriptor& desc) const; //! Add a descriptor to the wallet, return a ScriptPubKeyMan & associated output type - ScriptPubKeyMan* AddWalletDescriptor(WalletDescriptor& desc, const FlatSigningProvider& signing_provider, const std::string& label); + ScriptPubKeyMan* AddWalletDescriptor(WalletDescriptor& desc, const FlatSigningProvider& signing_provider, const std::string& label, bool internal); }; /** |