Skip to content

Commit 1355b20

Browse files
committed
Validation: Add new multi-inputs and multi-empty-outputs coinstake rules.
1 parent 599bd42 commit 1355b20

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/validation.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2935,6 +2935,22 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
29352935
}
29362936
}
29372937

2938+
bool fActiveV5_3 = chainparams.GetConsensus().NetworkUpgradeActive(nHeight, Consensus::UPGRADE_V5_3);
2939+
if (fActiveV5_3 && block.IsProofOfStake()) {
2940+
CTransactionRef csTx = block.vtx[1];
2941+
if (csTx->vin.size() > 1) {
2942+
return state.DoS(100, false, REJECT_INVALID, "bad-cs-multi-inputs", false,
2943+
"invalid multi-inputs coinstake");
2944+
}
2945+
2946+
// Prevent multi-empty-outputs
2947+
for (int i=1; i<csTx->vout.size(); i++ ) {
2948+
if (csTx->vout[i].IsEmpty()) {
2949+
return state.DoS(100, false, REJECT_INVALID, "bad-txns-vout-empty");
2950+
}
2951+
}
2952+
}
2953+
29382954
return true;
29392955
}
29402956

0 commit comments

Comments
 (0)