From 5a7304b69dcdb3323fbade3a150be94b42d8ab43 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 2 Jul 2015 20:57:39 +0200 Subject: [PATCH] Move recently introduced CTransAction::IsEquivalentTo to CWalletTx CTransAction::IsEquivalentTo was introduced in #5881. This functionality is only useful to the wallet, and should never have been added to the primitive transaction type. --- src/primitives/transaction.cpp | 9 --------- src/primitives/transaction.h | 3 --- src/wallet/wallet.cpp | 9 +++++++++ src/wallet/wallet.h | 3 +++ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index d864a9b6d..606dbea79 100644 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -87,15 +87,6 @@ CTransaction& CTransaction::operator=(const CTransaction &tx) { return *this; } -bool CTransaction::IsEquivalentTo(const CTransaction& tx) const -{ - CMutableTransaction tx1 = *this; - CMutableTransaction tx2 = tx; - for (unsigned int i = 0; i < tx1.vin.size(); i++) tx1.vin[i].scriptSig = CScript(); - for (unsigned int i = 0; i < tx2.vin.size(); i++) tx2.vin[i].scriptSig = CScript(); - return CTransaction(tx1) == CTransaction(tx2); -} - CAmount CTransaction::GetValueOut() const { CAmount nValueOut = 0; diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 0c9ebb7b8..6cfd93a9a 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -222,9 +222,6 @@ public: return hash; } - // True if only scriptSigs are different - bool IsEquivalentTo(const CTransaction& tx) const; - // Return sum of txouts. CAmount GetValueOut() const; // GetValueIn() is a method on CCoinsViewCache, because diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 44e28de0c..5811c0310 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1331,6 +1331,15 @@ bool CWalletTx::IsTrusted() const return true; } +bool CWalletTx::IsEquivalentTo(const CWalletTx& tx) const +{ + CMutableTransaction tx1 = *this; + CMutableTransaction tx2 = tx; + for (unsigned int i = 0; i < tx1.vin.size(); i++) tx1.vin[i].scriptSig = CScript(); + for (unsigned int i = 0; i < tx2.vin.size(); i++) tx2.vin[i].scriptSig = CScript(); + return CTransaction(tx1) == CTransaction(tx2); +} + std::vector CWallet::ResendWalletTransactionsBefore(int64_t nTime) { std::vector result; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index f36c98e9f..003266ba1 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -378,6 +378,9 @@ public: return (GetDebit(filter) > 0); } + // True if only scriptSigs are different + bool IsEquivalentTo(const CWalletTx& tx) const; + bool IsTrusted() const; bool WriteToDisk(CWalletDB *pwalletdb);