Skip to content

Conversation

@laanwj
Copy link
Member

@laanwj laanwj commented Jul 2, 2015

CTransAction::IsEquivalentTo was introduced in #5881.
This functionality is only used in the wallet, and should never have been added to the primitive transaction type.

CTransAction::IsEquivalentTo was introduced in bitcoin#5881.
This functionality is only useful to the wallet, and should never have
been added to the primitive transaction type.
@jonasschnelli
Copy link
Contributor

utACK.

@petertodd
Copy link
Contributor

utACK

@dgenr8
Copy link
Contributor

dgenr8 commented Jul 3, 2015

There is nothing wallet-specific about the method, and in fact it is needed in P2P code in #4570 (though the IsEquivalentTo implementation there is in need of update).

@laanwj
Copy link
Member Author

laanwj commented Jul 3, 2015

@dgenr8 I was more concerned with this belonging in the consensus library than anything else. We've been trying to detach methods from the base transaction data structures esp. those not used in consensus for a while. So this was a clear step in the wrong way.

If you do want to use it outside the wallet there are other solutions. Most straightforward is to make it an utility function that is not bound to any class:

bool AreTransactionsEquivalent(const CTransaction& txa, const CTransaction& txb) const
{
   CMutableTransaction tx1 = txa;
   CMutableTransaction tx2 = txb;
   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);
}

... but I wouldn't know where exactly to put it, then. Probably with other utility functions used for policy and wallet only.

Unless you have a good suggestion where to put it now, I'd say we should move ahead with this and then you can solve the issue in #4570 (if we are still going to merge that).

@dgenr8
Copy link
Contributor

dgenr8 commented Jul 3, 2015

Ok, no problem.

@laanwj laanwj merged commit 5a7304b into bitcoin:master Jul 6, 2015
laanwj added a commit that referenced this pull request Jul 6, 2015
5a7304b Move recently introduced CTransAction::IsEquivalentTo to CWalletTx (Wladimir J. van der Laan)
@dgenr8
Copy link
Contributor

dgenr8 commented Jul 12, 2015

The only existing non-consensus module that is shared between wallet and main, and knows about transactions, is validationinterface.

zkbot added a commit to zcash/zcash that referenced this pull request Feb 15, 2017
zkbot added a commit to zcash/zcash that referenced this pull request Feb 20, 2017
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants