From 01a6f2b2a5dc738a81bac667a1369cf8c900f9a8 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 7 Nov 2022 18:23:45 -0500 Subject: [PATCH] interfaces: Add isChange to wallet interface --- src/interfaces/wallet.h | 3 +++ src/wallet/interfaces.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index 0789e4bb1eb..bdc138b7177 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -124,6 +124,9 @@ class Wallet //! Save or remove receive request. virtual bool setAddressReceiveRequest(const CTxDestination& dest, const std::string& id, const std::string& value) = 0; + //! Whether the given output is a change + virtual bool isChange(const CTxOut& txout) const = 0; + //! Display address on external signer virtual bool displayAddress(const CTxDestination& dest) = 0; diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp index d082dd3c214..1b87910732f 100644 --- a/src/wallet/interfaces.cpp +++ b/src/wallet/interfaces.cpp @@ -245,6 +245,11 @@ class WalletImpl : public Wallet return value.empty() ? m_wallet->EraseAddressReceiveRequest(batch, dest, id) : m_wallet->SetAddressReceiveRequest(batch, dest, id, value); } + bool isChange(const CTxOut& txout) const override + { + LOCK(m_wallet->cs_wallet); + return OutputIsChange(*m_wallet, txout); + } bool displayAddress(const CTxDestination& dest) override { LOCK(m_wallet->cs_wallet);