diff options
Diffstat (limited to 'src/main.h')
| -rw-r--r-- | src/main.h | 15 |
1 files changed, 15 insertions, 0 deletions
| @@ -18,6 +18,11 @@ static const unsigned int MAX_SIZE = 0x02000000; | |||
| 18 | // Ceiling on transactions held waiting for a parent that has not arrived. | 18 | // Ceiling on transactions held waiting for a parent that has not arrived. |
| 19 | // They cost a peer nothing to send and are never validated, only stored. | 19 | // They cost a peer nothing to send and are never validated, only stored. |
| 20 | static const unsigned int MAX_ORPHAN_TRANSACTIONS = 100; | 20 | static const unsigned int MAX_ORPHAN_TRANSACTIONS = 100; |
| 21 | // Signature operations allowed in one block. Size alone does not bound what a | ||
| 22 | // block costs to validate: every OP_CHECKSIG is an elliptic-curve verification, | ||
| 23 | // so a block within the size limit could still hold millions of them and take | ||
| 24 | // the network minutes of CPU to reject. Same value Bitcoin settled on. | ||
| 25 | static const unsigned int MAX_BLOCK_SIGOPS = 20000; | ||
| 21 | static const int64 COIN = 100000000; | 26 | static const int64 COIN = 100000000; |
| 22 | // Total Bitflash emission: identical to Bitcoin (21 million). | 27 | // Total Bitflash emission: identical to Bitcoin (21 million). |
| 23 | // MAX_MONEY guards against the value overflow bug (CVE-2010-5139), which in | 28 | // MAX_MONEY guards against the value overflow bug (CVE-2010-5139), which in |
| @@ -503,6 +508,16 @@ public: | |||
| 503 | return (vin.size() == 1 && vin[0].prevout.IsNull()); | 508 | return (vin.size() == 1 && vin[0].prevout.IsNull()); |
| 504 | } | 509 | } |
| 505 | 510 | ||
| 511 | unsigned int GetSigOpCount() const | ||
| 512 | { | ||
| 513 | unsigned int n = 0; | ||
| 514 | foreach(const CTxIn& txin, vin) | ||
| 515 | n += txin.scriptSig.GetSigOpCount(); | ||
| 516 | foreach(const CTxOut& txout, vout) | ||
| 517 | n += txout.scriptPubKey.GetSigOpCount(); | ||
| 518 | return n; | ||
| 519 | } | ||
| 520 | |||
| 506 | bool CheckTransaction() const | 521 | bool CheckTransaction() const |
| 507 | { | 522 | { |
| 508 | // Basic checks that don't depend on any context | 523 | // Basic checks that don't depend on any context |