Skip to content

Commit

Permalink
Merge bitcoin#11161: Remove redundant explicitly defined copy ctors
Browse files Browse the repository at this point in the history
b426e24 Remove redundant explicitly defined copy ctors (Dan Raviv)

Pull request description:

  CFeeRate and CTxMemPoolEntry have explicitly defined copy ctors which has the same functionality as the implicit default copy ctors which would have been generated otherwise.

  Besides being redundant, it violates the rule of three (see https://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming) ).
  (Of course, the rule of three doesn't -really- cause a resource management issue here, but the reason for that is exactly that there is no need for an explicit copy ctor in the first place since no resources are being managed).

Tree-SHA512: c9294ebf5d955d230b44c6f0d20822975d44a34471a717d656f8b17181bcd2827f47ba897edf5accd650f5998c58aadc8ab3c91a3f556f1f6de36830ed4069ce
  • Loading branch information
laanwj authored and PastaPastaPasta committed Jan 2, 2020
1 parent 1da38ac commit 0ec5204
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/policy/feerate.h
Expand Up @@ -26,7 +26,6 @@ class CFeeRate
explicit CFeeRate(const CAmount& _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) { }
/** Constructor for a fee rate in satoshis per kB. The size in bytes must not exceed (2^63 - 1)*/
CFeeRate(const CAmount& nFeePaid, size_t nBytes);
CFeeRate(const CFeeRate& other) { nSatoshisPerK = other.nSatoshisPerK; }
/**
* Return the fee in satoshis for the given size in bytes.
*/
Expand Down
5 changes: 0 additions & 5 deletions src/txmempool.cpp
Expand Up @@ -46,11 +46,6 @@ CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& _tx, const CAmount& _nFe
nSigOpCountWithAncestors = sigOpCount;
}

CTxMemPoolEntry::CTxMemPoolEntry(const CTxMemPoolEntry& other)
{
*this = other;
}

void CTxMemPoolEntry::UpdateFeeDelta(int64_t newFeeDelta)
{
nModFeesWithDescendants += newFeeDelta - feeDelta;
Expand Down
2 changes: 0 additions & 2 deletions src/txmempool.h
Expand Up @@ -100,8 +100,6 @@ class CTxMemPoolEntry
bool spendsCoinbase,
unsigned int nSigOps, LockPoints lp);

CTxMemPoolEntry(const CTxMemPoolEntry& other);

const CTransaction& GetTx() const { return *this->tx; }
CTransactionRef GetSharedTx() const { return this->tx; }
const CAmount& GetFee() const { return nFee; }
Expand Down

0 comments on commit 0ec5204

Please sign in to comment.