Skip to content

Commit

Permalink
BugFix: cleanup invalid IsMasternodeReward method in OutPoint primitive.
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Apr 16, 2020
1 parent 30fe50f commit 9583c9e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
8 changes: 0 additions & 8 deletions src/primitives/transaction.cpp
Expand Up @@ -81,14 +81,6 @@ CTxOut::CTxOut(const CAmount& nValueIn, CScript scriptPubKeyIn)
nRounds = -10;
}

bool COutPoint::IsMasternodeReward(const CTransaction* tx) const
{
if(!tx->IsCoinStake())
return false;

return (n == tx->vout.size() - 1) && (tx->vout[1].scriptPubKey != tx->vout[n].scriptPubKey);
}

uint256 CTxOut::GetHash() const
{
return SerializeHash(*this);
Expand Down
1 change: 0 additions & 1 deletion src/primitives/transaction.h
Expand Up @@ -35,7 +35,6 @@ class COutPoint

void SetNull() { hash.SetNull(); n = (uint32_t) -1; }
bool IsNull() const { return (hash.IsNull() && n == (uint32_t) -1); }
bool IsMasternodeReward(const CTransaction* tx) const;

friend bool operator<(const COutPoint& a, const COutPoint& b)
{
Expand Down
8 changes: 5 additions & 3 deletions src/wallet/wallet.cpp
Expand Up @@ -3516,9 +3516,11 @@ bool CWallet::MultiSend()
if (out.tx->GetDepthInMainChain() != Params().GetConsensus().nCoinbaseMaturity + 1)
continue;

COutPoint outpoint(out.tx->GetHash(), out.i);
bool sendMSonMNReward = fMultiSendMasternodeReward && outpoint.IsMasternodeReward(out.tx);
bool sendMSOnStake = fMultiSendStake && out.tx->IsCoinStake() && !sendMSonMNReward; //output is either mnreward or stake reward, not both
bool isCoinStake = out.tx->IsCoinStake();
bool isMNOutPoint = isCoinStake && (out.i == ((int)out.tx->vout.size()) - 1) &&
(out.tx->vout[1].scriptPubKey != out.tx->vout[out.i].scriptPubKey);
bool sendMSonMNReward = fMultiSendMasternodeReward && isMNOutPoint;
bool sendMSOnStake = fMultiSendStake && isCoinStake && !sendMSonMNReward; //output is either mnreward or stake reward, not both

if (!(sendMSOnStake || sendMSonMNReward))
continue;
Expand Down

0 comments on commit 9583c9e

Please sign in to comment.