diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -25,7 +25,7 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx &wtx) { AssertLockHeld(cs_main); - if (!CheckFinalTx(wtx)) { + if (!CheckFinalTx(*wtx.tx)) { if (wtx.tx->nLockTime < LOCKTIME_THRESHOLD) { return tr("Open for %n more block(s)", "", wtx.tx->nLockTime - chainActive.Height()); diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -176,7 +176,7 @@ status.depth = wtx.GetDepthInMainChain(); status.cur_num_blocks = chainActive.Height(); - if (!CheckFinalTx(wtx)) { + if (!CheckFinalTx(*wtx.tx)) { if (wtx.tx->nLockTime < LOCKTIME_THRESHOLD) { status.status = TransactionStatus::OpenUntilBlock; status.open_for = wtx.tx->nLockTime - chainActive.Height(); diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -221,8 +221,7 @@ std::map::iterator mi = wallet->mapWallet.find(rec->txid); if (mi != wallet->mapWallet.end()) { - std::string strHex = - EncodeHexTx(static_cast(mi->second)); + std::string strHex = EncodeHexTx(*mi->second.tx); return QString::fromStdString(strHex); } return QString(); diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -392,7 +392,7 @@ LOCK2(cs_main, pwallet->cs_wallet); - if (pwallet->IsMine(wtx)) { + if (pwallet->IsMine(*wtx.tx)) { pwallet->AddToWallet(wtx, false); return NullUniValue; } diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2451,8 +2451,7 @@ ListTransactions(pwallet, wtx, "*", 0, false, details, filter); entry.pushKV("details", details); - std::string strHex = - EncodeHexTx(static_cast(wtx), RPCSerializationFlags()); + std::string strHex = EncodeHexTx(*wtx.tx, RPCSerializationFlags()); entry.pushKV("hex", strHex); return entry; diff --git a/src/wallet/test/accounting_tests.cpp b/src/wallet/test/accounting_tests.cpp --- a/src/wallet/test/accounting_tests.cpp +++ b/src/wallet/test/accounting_tests.cpp @@ -77,7 +77,7 @@ wtx.mapValue["comment"] = "y"; { - CMutableTransaction tx(wtx); + CMutableTransaction tx(*wtx.tx); // Just to change the hash :) --tx.nLockTime; wtx.SetTx(MakeTransactionRef(std::move(tx))); @@ -88,7 +88,7 @@ wtx.mapValue["comment"] = "x"; { - CMutableTransaction tx(wtx); + CMutableTransaction tx(*wtx.tx); // Just to change the hash :) --tx.nLockTime; wtx.SetTx(MakeTransactionRef(std::move(tx))); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -206,13 +206,6 @@ Init(); } - /** - * Helper conversion operator to allow passing CMerkleTx where CTransaction - * is expected. - * TODO: adapt callers and remove this operator. - */ - operator const CTransaction &() const { return *tx; } - void Init() { hashBlock = uint256(); nIndex = -1; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1869,7 +1869,7 @@ if (fDebitCached) { debit += nDebitCached; } else { - nDebitCached = pwallet->GetDebit(*this, ISMINE_SPENDABLE); + nDebitCached = pwallet->GetDebit(*tx, ISMINE_SPENDABLE); fDebitCached = true; debit += nDebitCached; } @@ -1879,7 +1879,7 @@ if (fWatchDebitCached) { debit += nWatchDebitCached; } else { - nWatchDebitCached = pwallet->GetDebit(*this, ISMINE_WATCH_ONLY); + nWatchDebitCached = pwallet->GetDebit(*tx, ISMINE_WATCH_ONLY); fWatchDebitCached = true; debit += Amount(nWatchDebitCached); } @@ -1901,7 +1901,7 @@ if (fCreditCached) { credit += nCreditCached; } else { - nCreditCached = pwallet->GetCredit(*this, ISMINE_SPENDABLE); + nCreditCached = pwallet->GetCredit(*tx, ISMINE_SPENDABLE); fCreditCached = true; credit += nCreditCached; } @@ -1911,7 +1911,7 @@ if (fWatchCreditCached) { credit += nWatchCreditCached; } else { - nWatchCreditCached = pwallet->GetCredit(*this, ISMINE_WATCH_ONLY); + nWatchCreditCached = pwallet->GetCredit(*tx, ISMINE_WATCH_ONLY); fWatchCreditCached = true; credit += nWatchCreditCached; } @@ -1926,7 +1926,7 @@ return nImmatureCreditCached; } - nImmatureCreditCached = pwallet->GetCredit(*this, ISMINE_SPENDABLE); + nImmatureCreditCached = pwallet->GetCredit(*tx, ISMINE_SPENDABLE); fImmatureCreditCached = true; return nImmatureCreditCached; } @@ -1972,8 +1972,7 @@ return nImmatureWatchCreditCached; } - nImmatureWatchCreditCached = - pwallet->GetCredit(*this, ISMINE_WATCH_ONLY); + nImmatureWatchCreditCached = pwallet->GetCredit(*tx, ISMINE_WATCH_ONLY); fImmatureWatchCreditCached = true; return nImmatureWatchCreditCached; } @@ -2018,7 +2017,7 @@ return nChangeCached; } - nChangeCached = pwallet->GetChange(*this); + nChangeCached = pwallet->GetChange(*tx); fChangeCached = true; return nChangeCached; } @@ -2029,7 +2028,7 @@ bool CWalletTx::IsTrusted() const { // Quick answer in most cases - if (!CheckFinalTx(*this)) { + if (!CheckFinalTx(*tx)) { return false; } @@ -2307,7 +2306,7 @@ const TxId &wtxid = entry.first; const CWalletTx *pcoin = &entry.second; - if (!CheckFinalTx(*pcoin)) { + if (!CheckFinalTx(*pcoin->tx)) { continue; } diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -302,8 +302,8 @@ ssValue >> wtx; CValidationState state; bool isValid = wtx.IsCoinBase() - ? CheckCoinbase(wtx, state) - : CheckRegularTransaction(wtx, state); + ? CheckCoinbase(*wtx.tx, state) + : CheckRegularTransaction(*wtx.tx, state); if (!isValid || wtx.GetId() != txid) { return false; }