diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 17e446e..a75bf54 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
| @@ -1261,6 +1261,16 @@ bool CBlock::CheckBlock() const | |||
| 1261 | if (!tx.CheckTransaction()) | 1261 | if (!tx.CheckTransaction()) |
| 1262 | return error("CheckBlock() : CheckTransaction failed"); | 1262 | return error("CheckBlock() : CheckTransaction failed"); |
| 1263 | 1263 | ||
| 1264 | // Cap the work a block can demand. MAX_SIZE bounds the bytes, not the cost: | ||
| 1265 | // every signature operation is an elliptic-curve verification, and at this | ||
| 1266 | // chain's difficulty a block packed with them is affordable to mine and | ||
| 1267 | // expensive for everyone else to reject. | ||
| 1268 | unsigned int nSigOps = 0; | ||
| 1269 | foreach(const CTransaction& tx, vtx) | ||
| 1270 | nSigOps += tx.GetSigOpCount(); | ||
| 1271 | if (nSigOps > MAX_BLOCK_SIGOPS) | ||
| 1272 | return error("CheckBlock() : out-of-bounds signature operation count"); | ||
| 1273 | |||
| 1264 | // Reject blocks carrying the same transaction twice (CVE-2012-2459). | 1274 | // Reject blocks carrying the same transaction twice (CVE-2012-2459). |
| 1265 | // | 1275 | // |
| 1266 | // BuildMerkleTree duplicates the last hash when a level has an odd width, | 1276 | // BuildMerkleTree duplicates the last hash when a level has an odd width, |