diff --git a/qml/models/transaction.cpp b/qml/models/transaction.cpp index a06b738789..3bfdea588f 100644 --- a/qml/models/transaction.cpp +++ b/qml/models/transaction.cpp @@ -173,11 +173,11 @@ QList> Transaction::fromWalletTx(const interfaces::W const CTxOut& txout = wtx.tx->vout[i]; if (fAllFromMe) { - // Change is only really possible if we're the sender - // Otherwise, someone just sent bitcoins to a change address, which should be shown - //if (wtx.txout_is_change[i]) { - // continue; - //} + // Only hide change when this wallet is the sender. If someone sends to + // one of our change addresses, it is still an incoming payment. + if (wtx.txout_is_change[i]) { + continue; + } // // Debit diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 582aff50e8..21becc2ff5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -27,6 +27,7 @@ add_executable(bitcoinqml_unit_tests test_walletqmlmodel.cpp test_bumptransactionmodel.cpp test_walletqmlcontroller.cpp + test_transaction.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../bitcoin/src/util/chaintype.cpp ) diff --git a/test/test_transaction.cpp b/test/test_transaction.cpp new file mode 100644 index 0000000000..7878cafac2 --- /dev/null +++ b/test/test_transaction.cpp @@ -0,0 +1,125 @@ +// Copyright (c) 2026 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include +#include +#include +#include