Skip to content

Commit

Permalink
Invoke CheckSpecialTx after all normal TX checks have passed (#2673)
Browse files Browse the repository at this point in the history
Otherwise duplicate-keys checks for deterministic masternodes triggers
for duplicate/identical transactions.
  • Loading branch information
codablock authored and UdjinM6 committed Feb 1, 2019
1 parent 18950f9 commit 1400df2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,9 +658,6 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
return state.DoS(100, false, REJECT_INVALID, "qc-not-allowed");
}

if (!CheckSpecialTx(tx, chainActive.Tip(), state))
return false;

// Coinbase is only valid in a block, not as a loose transaction
if (tx.IsCoinBase())
return state.DoS(100, false, REJECT_INVALID, "coinbase");
Expand Down Expand Up @@ -868,6 +865,12 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
return state.DoS(0, false, REJECT_NONSTANDARD, "too-long-mempool-chain", false, errString);
}

// check special TXs after all the other checks. If we'd do this before the other checks, we might end up
// DoS scoring a node for non-critical errors, e.g. duplicate keys because a TX is received that was already
// mined
if (!CheckSpecialTx(tx, chainActive.Tip(), state))
return false;

// If we aren't going to actually accept it but just were verifying it, we are fine already
if(fDryRun) return true;

Expand Down

0 comments on commit 1400df2

Please sign in to comment.