Skip to content

Commit 5a7304b

Browse files
committed
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.
1 parent 3f16971 commit 5a7304b

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/primitives/transaction.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,6 @@ CTransaction& CTransaction::operator=(const CTransaction &tx) {
8787
return *this;
8888
}
8989

90-
bool CTransaction::IsEquivalentTo(const CTransaction& tx) const
91-
{
92-
CMutableTransaction tx1 = *this;
93-
CMutableTransaction tx2 = tx;
94-
for (unsigned int i = 0; i < tx1.vin.size(); i++) tx1.vin[i].scriptSig = CScript();
95-
for (unsigned int i = 0; i < tx2.vin.size(); i++) tx2.vin[i].scriptSig = CScript();
96-
return CTransaction(tx1) == CTransaction(tx2);
97-
}
98-
9990
CAmount CTransaction::GetValueOut() const
10091
{
10192
CAmount nValueOut = 0;

src/primitives/transaction.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,6 @@ class CTransaction
222222
return hash;
223223
}
224224

225-
// True if only scriptSigs are different
226-
bool IsEquivalentTo(const CTransaction& tx) const;
227-
228225
// Return sum of txouts.
229226
CAmount GetValueOut() const;
230227
// GetValueIn() is a method on CCoinsViewCache, because

src/wallet/wallet.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,15 @@ bool CWalletTx::IsTrusted() const
13311331
return true;
13321332
}
13331333

1334+
bool CWalletTx::IsEquivalentTo(const CWalletTx& tx) const
1335+
{
1336+
CMutableTransaction tx1 = *this;
1337+
CMutableTransaction tx2 = tx;
1338+
for (unsigned int i = 0; i < tx1.vin.size(); i++) tx1.vin[i].scriptSig = CScript();
1339+
for (unsigned int i = 0; i < tx2.vin.size(); i++) tx2.vin[i].scriptSig = CScript();
1340+
return CTransaction(tx1) == CTransaction(tx2);
1341+
}
1342+
13341343
std::vector<uint256> CWallet::ResendWalletTransactionsBefore(int64_t nTime)
13351344
{
13361345
std::vector<uint256> result;

src/wallet/wallet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ class CWalletTx : public CMerkleTx
378378
return (GetDebit(filter) > 0);
379379
}
380380

381+
// True if only scriptSigs are different
382+
bool IsEquivalentTo(const CWalletTx& tx) const;
383+
381384
bool IsTrusted() const;
382385

383386
bool WriteToDisk(CWalletDB *pwalletdb);

0 commit comments

Comments
 (0)