mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Merge #13443: Removed unused == operator from CMutableTransaction.
55771b7c6a8d4a204c63e70db73a0071c41a0dc4 Removed unused == operator from CMutableTransaction. (lucash.dev@gmail.com) Pull request description: This removes the unused == operator from `CMutableTransaction`. The motivation is that unused code has a cost but offers no benefit (in general), while also adding the risk of introducing silent bugs. On top of that this particular code is quite inefficient, unnecessarily calculating the hash (it could, say, compare serializations). So if anyone ever needs to use a == comparison on `CMutableTransaction`, they'd be better of having to reimplement it (and add tests) than relying on code that's not being maintained. Note: after this, trying to use the == operator on CMutableTransactions results in a compilation error: ``` ./primitives/transaction.h:405:15: error: invalid operands to binary expression ('CMutableTransaction' and 'CMutableTransaction') ``` Tree-SHA512: a565af563e09d99347b6fe419f6d48c750b1377295af293a3e0c3c0d815e58aede8d7058987a68d66cfa7ed023e5d3285b12afabd17d0ff9cf11322ba3ce20fe
This commit is contained in:
parent
c1a84f6d59
commit
5c913efd1d
@ -449,7 +449,7 @@ bool CCoinJoinClientSession::SendDenominate(const std::vector<std::pair<CTxDSIn,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (txMyCollateral == CMutableTransaction()) {
|
||||
if (CTransaction(txMyCollateral).IsNull()) {
|
||||
LogPrint(BCLog::COINJOIN, "CCoinJoinClient:SendDenominate -- CoinJoin collateral not set\n");
|
||||
return false;
|
||||
}
|
||||
@ -913,7 +913,7 @@ bool CCoinJoinClientSession::DoAutomaticDenominating(CConnman& connman, bool fDr
|
||||
|
||||
//check our collateral and create new if needed
|
||||
std::string strReason;
|
||||
if (txMyCollateral == CMutableTransaction()) {
|
||||
if (CTransaction(txMyCollateral).IsNull()) {
|
||||
if (!CreateCollateralTransaction(txMyCollateral, strReason)) {
|
||||
LogPrint(BCLog::COINJOIN, "CCoinJoinClientSession::DoAutomaticDenominating -- create collateral error:%s\n", strReason);
|
||||
return false;
|
||||
|
@ -154,7 +154,7 @@ public:
|
||||
|
||||
friend bool operator==(const CCoinJoinAccept& a, const CCoinJoinAccept& b)
|
||||
{
|
||||
return a.nDenom == b.nDenom && a.txCollateral == b.txCollateral;
|
||||
return a.nDenom == b.nDenom && CTransaction(a.txCollateral) == CTransaction(b.txCollateral);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -301,17 +301,6 @@ struct CMutableTransaction
|
||||
uint256 GetHash() const;
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
friend bool operator==(const CMutableTransaction& a, const CMutableTransaction& b)
|
||||
{
|
||||
return a.GetHash() == b.GetHash();
|
||||
}
|
||||
|
||||
friend bool operator!=(const CMutableTransaction& a, const CMutableTransaction& b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<const CTransaction> CTransactionRef;
|
||||
|
Loading…
Reference in New Issue
Block a user