From ab21387c8b9b4bb5f051ec7544d5c14b11bf40f3 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 12:53:31 -0400 Subject: [PATCH] QT: Always return blinded address --- src/interfaces/wallet.cpp | 4 ++++ src/interfaces/wallet.h | 3 +++ src/qt/addresstablemodel.cpp | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 53e142c892..f7b3830c6e 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -192,6 +192,10 @@ public: return result; } void learnRelatedScripts(const CPubKey& key, OutputType type) override { m_wallet.LearnRelatedScripts(key, type); } + CPubKey getBlindingPubKey(const CScript& script) override + { + return m_wallet.GetBlindingPubKey(script); + } bool addDestData(const CTxDestination& dest, const std::string& key, const std::string& value) override { LOCK(m_wallet.cs_wallet); diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index d608aab0ad..d67861a257 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -111,6 +111,9 @@ public: //! database can detect payments to newer address types. virtual void learnRelatedScripts(const CPubKey& key, OutputType type) = 0; + //! Get blinding pubkey for script + virtual CPubKey getBlindingPubKey(const CScript& script) = 0; + //! Add dest data. virtual bool addDestData(const CTxDestination& dest, const std::string& key, const std::string& value) = 0; diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 2f88e15d21..784cc78ce5 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -380,7 +380,8 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con } } walletModel->wallet().learnRelatedScripts(newKey, address_type); - strAddress = EncodeDestination(GetDestinationForKey(newKey, address_type)); + CPubKey blinding_pubkey = walletModel->wallet().getBlindingPubKey(GetScriptForDestination(GetDestinationForKey(newKey, address_type))); + strAddress = EncodeDestination(GetDestinationForKey(newKey, address_type, blinding_pubkey)); } else {