diff options
Diffstat (limited to 'src/script.h')
| -rw-r--r-- | src/script.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/script.h b/src/script.h index 27c1b13..26bb65a 100644 --- a/src/script.h +++ b/src/script.h | |||
| @@ -536,6 +536,29 @@ public: | |||
| 536 | } | 536 | } |
| 537 | 537 | ||
| 538 | 538 | ||
| 539 | // Signature operations in this script. Each one costs every validating | ||
| 540 | // node an elliptic-curve verification, so blocks are capped on this count | ||
| 541 | // and not only on their size -- a byte of OP_CHECKSIG is far more | ||
| 542 | // expensive to check than a byte of anything else. | ||
| 543 | unsigned int GetSigOpCount() const | ||
| 544 | { | ||
| 545 | unsigned int n = 0; | ||
| 546 | const_iterator pc = begin(); | ||
| 547 | opcodetype opcode; | ||
| 548 | vector<unsigned char> vchPushValue; | ||
| 549 | while (pc < end()) | ||
| 550 | { | ||
| 551 | if (!GetOp(pc, opcode, vchPushValue)) | ||
| 552 | break; | ||
| 553 | if (opcode == OP_CHECKSIG || opcode == OP_CHECKSIGVERIFY) | ||
| 554 | n++; | ||
| 555 | else if (opcode == OP_CHECKMULTISIG || opcode == OP_CHECKMULTISIGVERIFY) | ||
| 556 | n += 20; | ||
| 557 | } | ||
| 558 | return n; | ||
| 559 | } | ||
| 560 | |||
| 561 | |||
| 539 | void FindAndDelete(const CScript& b) | 562 | void FindAndDelete(const CScript& b) |
| 540 | { | 563 | { |
| 541 | iterator pc = begin(); | 564 | iterator pc = begin(); |