diff --git a/src/wallet/receive.cpp b/src/wallet/receive.cpp index c48f7f63997..d8aa2c1718b 100644 --- a/src/wallet/receive.cpp +++ b/src/wallet/receive.cpp @@ -322,7 +322,7 @@ std::map GetAddressBalances(const CWallet& wallet) if (wallet.IsTXOInImmatureCoinBase(txo)) continue; int nDepth = wallet.GetTxStateDepthInMainChain(txo.GetState()); - if (nDepth < (CheckIsFromMeMap(txo.GetWalletTx().m_from_me, ISMINE_ALL) ? 0 : 1)) continue; + if (nDepth < (CheckIsFromMeMap(txo.GetTxFromMe(), ISMINE_ALL) ? 0 : 1)) continue; CTxDestination addr; Assume(wallet.IsMine(txo.GetTxOut())); diff --git a/src/wallet/transaction.h b/src/wallet/transaction.h index 30b5b04e0f6..9138ed1db47 100644 --- a/src/wallet/transaction.h +++ b/src/wallet/transaction.h @@ -380,14 +380,16 @@ private: isminetype m_ismine; TxState m_tx_state; bool m_tx_coinbase; + std::map m_tx_from_me; public: - WalletTXO(const CWalletTx& wtx, const CTxOut& output, const isminetype ismine, const TxState& state, bool coinbase) + WalletTXO(const CWalletTx& wtx, const CTxOut& output, const isminetype ismine, const TxState& state, bool coinbase, const std::map& tx_from_me) : m_wtx(wtx), m_output(output), m_ismine(ismine), m_tx_state(state), - m_tx_coinbase(coinbase) + m_tx_coinbase(coinbase), + m_tx_from_me(tx_from_me) {} const CWalletTx& GetWalletTx() const { return m_wtx; } @@ -401,6 +403,8 @@ public: void SetState(const TxState& state) { m_tx_state = state; } bool IsTxCoinBase() const { return m_tx_coinbase; } + + const std::map& GetTxFromMe() const { return m_tx_from_me; } }; } // namespace wallet diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 2a6857da773..51125c8c39a 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4709,7 +4709,7 @@ void CWallet::RefreshSingleTxTXOs(const CWalletTx& wtx) it->second.SetIsMine(ismine); it->second.SetState(wtx.m_state); } else { - m_txos.emplace(outpoint, WalletTXO{wtx, txout, ismine, wtx.m_state, wtx.IsCoinBase()}); + m_txos.emplace(outpoint, WalletTXO{wtx, txout, ismine, wtx.m_state, wtx.IsCoinBase(), wtx.m_from_me}); } } }