From b1b927839b305519e3bedff0e68f62d7c2961b8d 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 9736d93de8a..ed373f4444c 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -123,6 +123,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 e3b59c67b31..68dad731057 100644 --- a/src/wallet/interfaces.cpp +++ b/src/wallet/interfaces.cpp @@ -224,6 +224,11 @@ class WalletImpl : public Wallet WalletBatch batch{m_wallet->GetDatabase()}; return 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);