Skip to content

Commit 086cb33

Browse files
committed
Merge pull request #6365
5a7304b Move recently introduced CTransAction::IsEquivalentTo to CWalletTx (Wladimir J. van der Laan)
2 parents 9546a97 + 5a7304b commit 086cb33

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
@@ -1332,6 +1332,15 @@ bool CWalletTx::IsTrusted() const
13321332
return true;
13331333
}
13341334

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