diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-07-02 20:57:39 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-07-02 20:57:39 +0200 |
commit | 5a7304b69dcdb3323fbade3a150be94b42d8ab43 (patch) | |
tree | e4038cf2ee67d155abe711b6c8456b5cd5bf87f4 /src/wallet | |
parent | 3f16971442f1b52f94759b15998bc82e82a90aea (diff) |
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.
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/wallet.cpp | 9 | ||||
-rw-r--r-- | src/wallet/wallet.h | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 44e28de0cd..5811c0310a 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<uint256> CWallet::ResendWalletTransactionsBefore(int64_t nTime) { std::vector<uint256> result; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index f36c98e9fc..003266ba19 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); |