From 6b88691d7cbdb473791cea1d34c7e42a5567a107 Mon Sep 17 00:00:00 2001 From: David Burkett Date: Tue, 1 Mar 2022 18:28:59 -0500 Subject: [PATCH] Merge fix --- src/interfaces/wallet.cpp | 12 ++++++++---- src/interfaces/wallet.h | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 851ba83c5a..4edf17f068 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -49,8 +49,12 @@ WalletTxOut MakeWalletTxOut(CWallet& wallet, if (output.IsMWEB()) { mw::Coin coin; - if (wallet.GetCoin(output.ToMWEB(), coin)) { - result.address = wallet.GetMWWallet()->GetStealthAddress(coin.address_index); + if (wallet.GetCoin(output.ToMWEB(), coin) && coin.IsMine()) { + StealthAddress addr; + if (wallet.GetMWWallet()->GetStealthAddress(coin, addr)) { + result.address = addr; + } + result.nValue = coin.amount; } } else { @@ -538,9 +542,9 @@ public: RemoveWallet(m_wallet, false /* load_on_start */); } bool isLegacy() override { return m_wallet->IsLegacy(); } - StealthAddress getPeginAddress() override + bool getPeginAddress(StealthAddress& pegin_address) override { - return m_wallet->GetMWWallet()->GetStealthAddress(mw::PEGIN_INDEX); + return m_wallet->GetMWWallet()->GetStealthAddress(mw::PEGIN_INDEX, pegin_address); } std::unique_ptr handleUnload(UnloadFn fn) override { diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index 87bac7e0f8..a5cbea0914 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -283,8 +283,8 @@ public: //! Return whether is a legacy wallet virtual bool isLegacy() = 0; - // Get MWEB wallet. - virtual StealthAddress getPeginAddress() = 0; + // Get pegin address from MWEB wallet. + virtual bool getPeginAddress(StealthAddress& pegin_address) = 0; //! Register handler for unload message. using UnloadFn = std::function;