diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -1529,7 +1529,7 @@ "Error adding address to wallet"); } if (!pwallet->ImportScriptPubKeys(label, script_pub_keys, - have_solving_data, internal, + have_solving_data, !internal, timestamp)) { throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet"); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1280,8 +1280,8 @@ EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); bool ImportScriptPubKeys(const std::string &label, const std::set &script_pub_keys, - const bool have_solving_data, const bool internal, - const int64_t timestamp) + const bool have_solving_data, + const bool apply_label, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); CFeeRate m_pay_tx_fee{DEFAULT_PAY_TX_FEE}; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1907,7 +1907,7 @@ bool CWallet::ImportScriptPubKeys(const std::string &label, const std::set &script_pub_keys, const bool have_solving_data, - const bool internal, + const bool apply_label, const int64_t timestamp) { WalletBatch batch(*database); for (const CScript &script : script_pub_keys) { @@ -1920,7 +1920,7 @@ } CTxDestination dest; ExtractDestination(script, dest); - if (!internal && IsValidDestination(dest)) { + if (apply_label && IsValidDestination(dest)) { SetAddressBookWithDB(batch, dest, label, "receive"); } }