diff options
| author | Tom Harding <[email protected]> | 2015-03-11 16:48:53 -0700 |
|---|---|---|
| committer | Tom Harding <[email protected]> | 2015-04-11 19:03:58 -0700 |
| commit | b2b361926215eadd6bf43ed1d7110b925fc7cae5 (patch) | |
| tree | 82db9091d3556b309368bbe63806602ef26cfe87 /src/primitives/transaction.cpp | |
| parent | Merge pull request #5991 (diff) | |
| download | discoin-b2b361926215eadd6bf43ed1d7110b925fc7cae5.tar.xz discoin-b2b361926215eadd6bf43ed1d7110b925fc7cae5.zip | |
Implement CTransaction::IsEquivalentTo(...)
Define CTransaction::IsEquivalentTo(const CTransaction& tx)
True if only scriptSigs are different. In other words, true if
the two transactions are malleability clones. In other words,
true if the two transactions have the same effect on the
outside universe.
In the wallet, only SyncMetaData for equivalent transactions.
Diffstat (limited to 'src/primitives/transaction.cpp')
| -rw-r--r-- | src/primitives/transaction.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index 606dbea79..d864a9b6d 100644 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -87,6 +87,15 @@ 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; |