diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index 33746b3c21c..089afd15d02 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -445,7 +445,7 @@ CoinsResult AvailableCoins(const CWallet& wallet, } result.Add(GetOutputType(type, is_from_p2sh), - COutput(outpoint, output, nDepth, input_bytes, spendable, solvable, tx_safe, wtx.GetTxTime(), tx_from_me, feerate)); + COutput(outpoint, output, nDepth, input_bytes, spendable, solvable, tx_safe, txo.GetTxTime(), tx_from_me, feerate)); outpoints.push_back(outpoint); diff --git a/src/wallet/transaction.h b/src/wallet/transaction.h index 9138ed1db47..b5c9450bb97 100644 --- a/src/wallet/transaction.h +++ b/src/wallet/transaction.h @@ -381,15 +381,17 @@ private: TxState m_tx_state; bool m_tx_coinbase; std::map m_tx_from_me; + int64_t m_tx_time; public: - WalletTXO(const CWalletTx& wtx, const CTxOut& output, const isminetype ismine, const TxState& state, bool coinbase, const std::map& tx_from_me) + WalletTXO(const CWalletTx& wtx, const CTxOut& output, const isminetype ismine, const TxState& state, bool coinbase, const std::map& tx_from_me, int64_t tx_time) : m_wtx(wtx), m_output(output), m_ismine(ismine), m_tx_state(state), m_tx_coinbase(coinbase), - m_tx_from_me(tx_from_me) + m_tx_from_me(tx_from_me), + m_tx_time(tx_time) {} const CWalletTx& GetWalletTx() const { return m_wtx; } @@ -405,6 +407,8 @@ public: bool IsTxCoinBase() const { return m_tx_coinbase; } const std::map& GetTxFromMe() const { return m_tx_from_me; } + + int64_t GetTxTime() const { return m_tx_time; } }; } // namespace wallet diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 51125c8c39a..0156dae0094 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(), wtx.m_from_me}); + m_txos.emplace(outpoint, WalletTXO{wtx, txout, ismine, wtx.m_state, wtx.IsCoinBase(), wtx.m_from_me, wtx.GetTxTime()}); } } }