Skip to content

Commit

Permalink
interfaces: Add isChange to wallet interface
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed Oct 4, 2024
1 parent 15ebc44 commit e1cce62
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/interfaces/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,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 util::Result<void> displayAddress(const CTxDestination& dest) = 0;

Expand Down
5 changes: 5 additions & 0 deletions src/wallet/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,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);
}
util::Result<void> displayAddress(const CTxDestination& dest) override
{
LOCK(m_wallet->cs_wallet);
Expand Down

0 comments on commit e1cce62

Please sign in to comment.