-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Move recently introduced CTransAction::IsEquivalentTo to CWalletTx #6365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move recently introduced CTransAction::IsEquivalentTo to CWalletTx #6365
Conversation
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.
|
utACK. |
|
utACK |
|
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). |
|
@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). |
|
Ok, no problem. |
5a7304b Move recently introduced CTransAction::IsEquivalentTo to CWalletTx (Wladimir J. van der Laan)
|
The only existing non-consensus module that is shared between wallet and main, and knows about transactions, is |
Bitcoin 0.12 test PRs 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6337 - bitcoin/bitcoin#5881 - bitcoin/bitcoin#6365 - bitcoin/bitcoin#6390 - bitcoin/bitcoin#6414 - bitcoin/bitcoin#5515 - bitcoin/bitcoin#6287 (partial, remainder included in bitcoin/bitcoin#6703) - bitcoin/bitcoin#6465 Part of #2074.
Bitcoin 0.12 test PRs 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6337 - bitcoin/bitcoin#5881 - bitcoin/bitcoin@3f16971 - bitcoin/bitcoin#6365 - bitcoin/bitcoin@56dc704 - bitcoin/bitcoin#6390 - bitcoin/bitcoin#6414 - bitcoin/bitcoin#5515 - bitcoin/bitcoin#6287 (partial, remainder included in bitcoin/bitcoin#6703) - bitcoin/bitcoin#6465 Part of #2074.
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.