github.com/BlockABC/godash@v0.0.0-20191112120524-f4aa3a32c566/txscript/internal_test.go (about) 1 // Copyright (c) 2013-2015 The btcsuite developers 2 // Copyright (c) 2016 The Dash developers 3 // Use of this source code is governed by an ISC 4 // license that can be found in the LICENSE file. 5 6 /* 7 This test file is part of the txscript package rather than than the 8 txscript_test package so it can bridge access to the internals to properly test 9 cases which are either not possible or can't reliably be tested via the public 10 interface. The functions are only exported while the tests are being run. 11 */ 12 13 package txscript 14 15 import "testing" 16 17 // TstMaxScriptSize makes the internal maxScriptSize constant available to the 18 // test package. 19 const TstMaxScriptSize = maxScriptSize 20 21 // TstHasCanoncialPushes makes the internal isCanonicalPush function available 22 // to the test package. 23 var TstHasCanonicalPushes = canonicalPush 24 25 // TstParseScript makes the internal parseScript function available to the 26 // test package. 27 var TstParseScript = parseScript 28 29 // TstCalcSignatureHash makes the internal calcSignatureHash function available 30 // to the test package. 31 var TstCalcSignatureHash = calcSignatureHash 32 33 // TstConcatRawScript makes the ability to add the pass script directly to 34 // an existing script to the test package. This differs from AddData since it 35 // doesn't add a push data opcode. 36 func (b *ScriptBuilder) TstConcatRawScript(data []byte) *ScriptBuilder { 37 if b.err != nil { 38 return b 39 } 40 41 b.script = append(b.script, data...) 42 return b 43 } 44 45 // TstCheckPubKeyEncoding makes the internal checkPubKeyEncoding function 46 // available to the test package. Since it only really needs from the engine 47 // for the flags, just accept the flags and create a new engine skeleton. 48 func TstCheckPubKeyEncoding(pubKey []byte, flags ScriptFlags) error { 49 vm := Engine{flags: flags} 50 return vm.checkPubKeyEncoding(pubKey) 51 } 52 53 // TstCheckSignatureEncoding makes the internal checkSignatureEncoding function 54 // available to the test package. Since it only really needs from the engine 55 // for the flags, just accept the flags and create a new engine skeleton with 56 // them. 57 func TstCheckSignatureEncoding(sig []byte, flags ScriptFlags) error { 58 vm := Engine{flags: flags} 59 return vm.checkSignatureEncoding(sig) 60 } 61 62 // TstRemoveOpcode makes the internal removeOpcode function available to the 63 // test package. 64 func TstRemoveOpcode(pkscript []byte, opcode byte) ([]byte, error) { 65 pops, err := parseScript(pkscript) 66 if err != nil { 67 return nil, err 68 } 69 pops = removeOpcode(pops, opcode) 70 return unparseScript(pops) 71 } 72 73 // TstRemoveOpcodeByData makes the internal removeOpcodeByData function 74 // available to the test package. 75 func TstRemoveOpcodeByData(pkscript []byte, data []byte) ([]byte, error) { 76 pops, err := parseScript(pkscript) 77 if err != nil { 78 return nil, err 79 } 80 pops = removeOpcodeByData(pops, data) 81 return unparseScript(pops) 82 } 83 84 // TestSetPC allows the test modules to set the program counter to whatever they 85 // want. 86 func (vm *Engine) TstSetPC(script, off int) { 87 vm.scriptIdx = script 88 vm.scriptOff = off 89 } 90 91 // Internal tests for opcode parsing with bad data templates. 92 func TestParseOpcode(t *testing.T) { 93 // Deep copy the array and make one of the opcodes invalid by setting it 94 // to the wrong length. 95 fakeArray := opcodeArray 96 fakeArray[OP_PUSHDATA4] = opcode{value: OP_PUSHDATA4, 97 name: "OP_PUSHDATA4", length: -8, opfunc: opcodePushData} 98 99 // This script would be fine if -8 was a valid length. 100 _, err := parseScriptTemplate([]byte{OP_PUSHDATA4, 0x1, 0x00, 0x00, 101 0x00, 0x00, 0x00, 0x00, 0x00}, &fakeArray) 102 if err == nil { 103 t.Errorf("no error with dodgy opcode array!") 104 } 105 } 106 107 func TestUnparsingInvalidOpcodes(t *testing.T) { 108 tests := []struct { 109 name string 110 pop *parsedOpcode 111 expectedErr error 112 }{ 113 { 114 name: "OP_FALSE", 115 pop: &parsedOpcode{ 116 opcode: &opcodeArray[OP_FALSE], 117 data: nil, 118 }, 119 expectedErr: nil, 120 }, 121 { 122 name: "OP_FALSE long", 123 pop: &parsedOpcode{ 124 opcode: &opcodeArray[OP_FALSE], 125 data: make([]byte, 1), 126 }, 127 expectedErr: ErrStackInvalidOpcode, 128 }, 129 { 130 name: "OP_DATA_1 short", 131 pop: &parsedOpcode{ 132 opcode: &opcodeArray[OP_DATA_1], 133 data: nil, 134 }, 135 expectedErr: ErrStackInvalidOpcode, 136 }, 137 { 138 name: "OP_DATA_1", 139 pop: &parsedOpcode{ 140 opcode: &opcodeArray[OP_DATA_1], 141 data: make([]byte, 1), 142 }, 143 expectedErr: nil, 144 }, 145 { 146 name: "OP_DATA_1 long", 147 pop: &parsedOpcode{ 148 opcode: &opcodeArray[OP_DATA_1], 149 data: make([]byte, 2), 150 }, 151 expectedErr: ErrStackInvalidOpcode, 152 }, 153 { 154 name: "OP_DATA_2 short", 155 pop: &parsedOpcode{ 156 opcode: &opcodeArray[OP_DATA_2], 157 data: make([]byte, 1), 158 }, 159 expectedErr: ErrStackInvalidOpcode, 160 }, 161 { 162 name: "OP_DATA_2", 163 pop: &parsedOpcode{ 164 opcode: &opcodeArray[OP_DATA_2], 165 data: make([]byte, 2), 166 }, 167 expectedErr: nil, 168 }, 169 { 170 name: "OP_DATA_2 long", 171 pop: &parsedOpcode{ 172 opcode: &opcodeArray[OP_DATA_2], 173 data: make([]byte, 3), 174 }, 175 expectedErr: ErrStackInvalidOpcode, 176 }, 177 { 178 name: "OP_DATA_3 short", 179 pop: &parsedOpcode{ 180 opcode: &opcodeArray[OP_DATA_3], 181 data: make([]byte, 2), 182 }, 183 expectedErr: ErrStackInvalidOpcode, 184 }, 185 { 186 name: "OP_DATA_3", 187 pop: &parsedOpcode{ 188 opcode: &opcodeArray[OP_DATA_3], 189 data: make([]byte, 3), 190 }, 191 expectedErr: nil, 192 }, 193 { 194 name: "OP_DATA_3 long", 195 pop: &parsedOpcode{ 196 opcode: &opcodeArray[OP_DATA_3], 197 data: make([]byte, 4), 198 }, 199 expectedErr: ErrStackInvalidOpcode, 200 }, 201 { 202 name: "OP_DATA_4 short", 203 pop: &parsedOpcode{ 204 opcode: &opcodeArray[OP_DATA_4], 205 data: make([]byte, 3), 206 }, 207 expectedErr: ErrStackInvalidOpcode, 208 }, 209 { 210 name: "OP_DATA_4", 211 pop: &parsedOpcode{ 212 opcode: &opcodeArray[OP_DATA_4], 213 data: make([]byte, 4), 214 }, 215 expectedErr: nil, 216 }, 217 { 218 name: "OP_DATA_4 long", 219 pop: &parsedOpcode{ 220 opcode: &opcodeArray[OP_DATA_4], 221 data: make([]byte, 5), 222 }, 223 expectedErr: ErrStackInvalidOpcode, 224 }, 225 { 226 name: "OP_DATA_5 short", 227 pop: &parsedOpcode{ 228 opcode: &opcodeArray[OP_DATA_5], 229 data: make([]byte, 4), 230 }, 231 expectedErr: ErrStackInvalidOpcode, 232 }, 233 { 234 name: "OP_DATA_5", 235 pop: &parsedOpcode{ 236 opcode: &opcodeArray[OP_DATA_5], 237 data: make([]byte, 5), 238 }, 239 expectedErr: nil, 240 }, 241 { 242 name: "OP_DATA_5 long", 243 pop: &parsedOpcode{ 244 opcode: &opcodeArray[OP_DATA_5], 245 data: make([]byte, 6), 246 }, 247 expectedErr: ErrStackInvalidOpcode, 248 }, 249 { 250 name: "OP_DATA_6 short", 251 pop: &parsedOpcode{ 252 opcode: &opcodeArray[OP_DATA_6], 253 data: make([]byte, 5), 254 }, 255 expectedErr: ErrStackInvalidOpcode, 256 }, 257 { 258 name: "OP_DATA_6", 259 pop: &parsedOpcode{ 260 opcode: &opcodeArray[OP_DATA_6], 261 data: make([]byte, 6), 262 }, 263 expectedErr: nil, 264 }, 265 { 266 name: "OP_DATA_6 long", 267 pop: &parsedOpcode{ 268 opcode: &opcodeArray[OP_DATA_6], 269 data: make([]byte, 7), 270 }, 271 expectedErr: ErrStackInvalidOpcode, 272 }, 273 { 274 name: "OP_DATA_7 short", 275 pop: &parsedOpcode{ 276 opcode: &opcodeArray[OP_DATA_7], 277 data: make([]byte, 6), 278 }, 279 expectedErr: ErrStackInvalidOpcode, 280 }, 281 { 282 name: "OP_DATA_7", 283 pop: &parsedOpcode{ 284 opcode: &opcodeArray[OP_DATA_7], 285 data: make([]byte, 7), 286 }, 287 expectedErr: nil, 288 }, 289 { 290 name: "OP_DATA_7 long", 291 pop: &parsedOpcode{ 292 opcode: &opcodeArray[OP_DATA_7], 293 data: make([]byte, 8), 294 }, 295 expectedErr: ErrStackInvalidOpcode, 296 }, 297 { 298 name: "OP_DATA_8 short", 299 pop: &parsedOpcode{ 300 opcode: &opcodeArray[OP_DATA_8], 301 data: make([]byte, 7), 302 }, 303 expectedErr: ErrStackInvalidOpcode, 304 }, 305 { 306 name: "OP_DATA_8", 307 pop: &parsedOpcode{ 308 opcode: &opcodeArray[OP_DATA_8], 309 data: make([]byte, 8), 310 }, 311 expectedErr: nil, 312 }, 313 { 314 name: "OP_DATA_8 long", 315 pop: &parsedOpcode{ 316 opcode: &opcodeArray[OP_DATA_8], 317 data: make([]byte, 9), 318 }, 319 expectedErr: ErrStackInvalidOpcode, 320 }, 321 { 322 name: "OP_DATA_9 short", 323 pop: &parsedOpcode{ 324 opcode: &opcodeArray[OP_DATA_9], 325 data: make([]byte, 8), 326 }, 327 expectedErr: ErrStackInvalidOpcode, 328 }, 329 { 330 name: "OP_DATA_9", 331 pop: &parsedOpcode{ 332 opcode: &opcodeArray[OP_DATA_9], 333 data: make([]byte, 9), 334 }, 335 expectedErr: nil, 336 }, 337 { 338 name: "OP_DATA_9 long", 339 pop: &parsedOpcode{ 340 opcode: &opcodeArray[OP_DATA_9], 341 data: make([]byte, 10), 342 }, 343 expectedErr: ErrStackInvalidOpcode, 344 }, 345 { 346 name: "OP_DATA_10 short", 347 pop: &parsedOpcode{ 348 opcode: &opcodeArray[OP_DATA_10], 349 data: make([]byte, 9), 350 }, 351 expectedErr: ErrStackInvalidOpcode, 352 }, 353 { 354 name: "OP_DATA_10", 355 pop: &parsedOpcode{ 356 opcode: &opcodeArray[OP_DATA_10], 357 data: make([]byte, 10), 358 }, 359 expectedErr: nil, 360 }, 361 { 362 name: "OP_DATA_10 long", 363 pop: &parsedOpcode{ 364 opcode: &opcodeArray[OP_DATA_10], 365 data: make([]byte, 11), 366 }, 367 expectedErr: ErrStackInvalidOpcode, 368 }, 369 { 370 name: "OP_DATA_11 short", 371 pop: &parsedOpcode{ 372 opcode: &opcodeArray[OP_DATA_11], 373 data: make([]byte, 10), 374 }, 375 expectedErr: ErrStackInvalidOpcode, 376 }, 377 { 378 name: "OP_DATA_11", 379 pop: &parsedOpcode{ 380 opcode: &opcodeArray[OP_DATA_11], 381 data: make([]byte, 11), 382 }, 383 expectedErr: nil, 384 }, 385 { 386 name: "OP_DATA_11 long", 387 pop: &parsedOpcode{ 388 opcode: &opcodeArray[OP_DATA_11], 389 data: make([]byte, 12), 390 }, 391 expectedErr: ErrStackInvalidOpcode, 392 }, 393 { 394 name: "OP_DATA_12 short", 395 pop: &parsedOpcode{ 396 opcode: &opcodeArray[OP_DATA_12], 397 data: make([]byte, 11), 398 }, 399 expectedErr: ErrStackInvalidOpcode, 400 }, 401 { 402 name: "OP_DATA_12", 403 pop: &parsedOpcode{ 404 opcode: &opcodeArray[OP_DATA_12], 405 data: make([]byte, 12), 406 }, 407 expectedErr: nil, 408 }, 409 { 410 name: "OP_DATA_12 long", 411 pop: &parsedOpcode{ 412 opcode: &opcodeArray[OP_DATA_12], 413 data: make([]byte, 13), 414 }, 415 expectedErr: ErrStackInvalidOpcode, 416 }, 417 { 418 name: "OP_DATA_13 short", 419 pop: &parsedOpcode{ 420 opcode: &opcodeArray[OP_DATA_13], 421 data: make([]byte, 12), 422 }, 423 expectedErr: ErrStackInvalidOpcode, 424 }, 425 { 426 name: "OP_DATA_13", 427 pop: &parsedOpcode{ 428 opcode: &opcodeArray[OP_DATA_13], 429 data: make([]byte, 13), 430 }, 431 expectedErr: nil, 432 }, 433 { 434 name: "OP_DATA_13 long", 435 pop: &parsedOpcode{ 436 opcode: &opcodeArray[OP_DATA_13], 437 data: make([]byte, 14), 438 }, 439 expectedErr: ErrStackInvalidOpcode, 440 }, 441 { 442 name: "OP_DATA_14 short", 443 pop: &parsedOpcode{ 444 opcode: &opcodeArray[OP_DATA_14], 445 data: make([]byte, 13), 446 }, 447 expectedErr: ErrStackInvalidOpcode, 448 }, 449 { 450 name: "OP_DATA_14", 451 pop: &parsedOpcode{ 452 opcode: &opcodeArray[OP_DATA_14], 453 data: make([]byte, 14), 454 }, 455 expectedErr: nil, 456 }, 457 { 458 name: "OP_DATA_14 long", 459 pop: &parsedOpcode{ 460 opcode: &opcodeArray[OP_DATA_14], 461 data: make([]byte, 15), 462 }, 463 expectedErr: ErrStackInvalidOpcode, 464 }, 465 { 466 name: "OP_DATA_15 short", 467 pop: &parsedOpcode{ 468 opcode: &opcodeArray[OP_DATA_15], 469 data: make([]byte, 14), 470 }, 471 expectedErr: ErrStackInvalidOpcode, 472 }, 473 { 474 name: "OP_DATA_15", 475 pop: &parsedOpcode{ 476 opcode: &opcodeArray[OP_DATA_15], 477 data: make([]byte, 15), 478 }, 479 expectedErr: nil, 480 }, 481 { 482 name: "OP_DATA_15 long", 483 pop: &parsedOpcode{ 484 opcode: &opcodeArray[OP_DATA_15], 485 data: make([]byte, 16), 486 }, 487 expectedErr: ErrStackInvalidOpcode, 488 }, 489 { 490 name: "OP_DATA_16 short", 491 pop: &parsedOpcode{ 492 opcode: &opcodeArray[OP_DATA_16], 493 data: make([]byte, 15), 494 }, 495 expectedErr: ErrStackInvalidOpcode, 496 }, 497 { 498 name: "OP_DATA_16", 499 pop: &parsedOpcode{ 500 opcode: &opcodeArray[OP_DATA_16], 501 data: make([]byte, 16), 502 }, 503 expectedErr: nil, 504 }, 505 { 506 name: "OP_DATA_16 long", 507 pop: &parsedOpcode{ 508 opcode: &opcodeArray[OP_DATA_16], 509 data: make([]byte, 17), 510 }, 511 expectedErr: ErrStackInvalidOpcode, 512 }, 513 { 514 name: "OP_DATA_17 short", 515 pop: &parsedOpcode{ 516 opcode: &opcodeArray[OP_DATA_17], 517 data: make([]byte, 16), 518 }, 519 expectedErr: ErrStackInvalidOpcode, 520 }, 521 { 522 name: "OP_DATA_17", 523 pop: &parsedOpcode{ 524 opcode: &opcodeArray[OP_DATA_17], 525 data: make([]byte, 17), 526 }, 527 expectedErr: nil, 528 }, 529 { 530 name: "OP_DATA_17 long", 531 pop: &parsedOpcode{ 532 opcode: &opcodeArray[OP_DATA_17], 533 data: make([]byte, 18), 534 }, 535 expectedErr: ErrStackInvalidOpcode, 536 }, 537 { 538 name: "OP_DATA_18 short", 539 pop: &parsedOpcode{ 540 opcode: &opcodeArray[OP_DATA_18], 541 data: make([]byte, 17), 542 }, 543 expectedErr: ErrStackInvalidOpcode, 544 }, 545 { 546 name: "OP_DATA_18", 547 pop: &parsedOpcode{ 548 opcode: &opcodeArray[OP_DATA_18], 549 data: make([]byte, 18), 550 }, 551 expectedErr: nil, 552 }, 553 { 554 name: "OP_DATA_18 long", 555 pop: &parsedOpcode{ 556 opcode: &opcodeArray[OP_DATA_18], 557 data: make([]byte, 19), 558 }, 559 expectedErr: ErrStackInvalidOpcode, 560 }, 561 { 562 name: "OP_DATA_19 short", 563 pop: &parsedOpcode{ 564 opcode: &opcodeArray[OP_DATA_19], 565 data: make([]byte, 18), 566 }, 567 expectedErr: ErrStackInvalidOpcode, 568 }, 569 { 570 name: "OP_DATA_19", 571 pop: &parsedOpcode{ 572 opcode: &opcodeArray[OP_DATA_19], 573 data: make([]byte, 19), 574 }, 575 expectedErr: nil, 576 }, 577 { 578 name: "OP_DATA_19 long", 579 pop: &parsedOpcode{ 580 opcode: &opcodeArray[OP_DATA_19], 581 data: make([]byte, 20), 582 }, 583 expectedErr: ErrStackInvalidOpcode, 584 }, 585 { 586 name: "OP_DATA_20 short", 587 pop: &parsedOpcode{ 588 opcode: &opcodeArray[OP_DATA_20], 589 data: make([]byte, 19), 590 }, 591 expectedErr: ErrStackInvalidOpcode, 592 }, 593 { 594 name: "OP_DATA_20", 595 pop: &parsedOpcode{ 596 opcode: &opcodeArray[OP_DATA_20], 597 data: make([]byte, 20), 598 }, 599 expectedErr: nil, 600 }, 601 { 602 name: "OP_DATA_20 long", 603 pop: &parsedOpcode{ 604 opcode: &opcodeArray[OP_DATA_20], 605 data: make([]byte, 21), 606 }, 607 expectedErr: ErrStackInvalidOpcode, 608 }, 609 { 610 name: "OP_DATA_21 short", 611 pop: &parsedOpcode{ 612 opcode: &opcodeArray[OP_DATA_21], 613 data: make([]byte, 20), 614 }, 615 expectedErr: ErrStackInvalidOpcode, 616 }, 617 { 618 name: "OP_DATA_21", 619 pop: &parsedOpcode{ 620 opcode: &opcodeArray[OP_DATA_21], 621 data: make([]byte, 21), 622 }, 623 expectedErr: nil, 624 }, 625 { 626 name: "OP_DATA_21 long", 627 pop: &parsedOpcode{ 628 opcode: &opcodeArray[OP_DATA_21], 629 data: make([]byte, 22), 630 }, 631 expectedErr: ErrStackInvalidOpcode, 632 }, 633 { 634 name: "OP_DATA_22 short", 635 pop: &parsedOpcode{ 636 opcode: &opcodeArray[OP_DATA_22], 637 data: make([]byte, 21), 638 }, 639 expectedErr: ErrStackInvalidOpcode, 640 }, 641 { 642 name: "OP_DATA_22", 643 pop: &parsedOpcode{ 644 opcode: &opcodeArray[OP_DATA_22], 645 data: make([]byte, 22), 646 }, 647 expectedErr: nil, 648 }, 649 { 650 name: "OP_DATA_22 long", 651 pop: &parsedOpcode{ 652 opcode: &opcodeArray[OP_DATA_22], 653 data: make([]byte, 23), 654 }, 655 expectedErr: ErrStackInvalidOpcode, 656 }, 657 { 658 name: "OP_DATA_23 short", 659 pop: &parsedOpcode{ 660 opcode: &opcodeArray[OP_DATA_23], 661 data: make([]byte, 22), 662 }, 663 expectedErr: ErrStackInvalidOpcode, 664 }, 665 { 666 name: "OP_DATA_23", 667 pop: &parsedOpcode{ 668 opcode: &opcodeArray[OP_DATA_23], 669 data: make([]byte, 23), 670 }, 671 expectedErr: nil, 672 }, 673 { 674 name: "OP_DATA_23 long", 675 pop: &parsedOpcode{ 676 opcode: &opcodeArray[OP_DATA_23], 677 data: make([]byte, 24), 678 }, 679 expectedErr: ErrStackInvalidOpcode, 680 }, 681 { 682 name: "OP_DATA_24 short", 683 pop: &parsedOpcode{ 684 opcode: &opcodeArray[OP_DATA_24], 685 data: make([]byte, 23), 686 }, 687 expectedErr: ErrStackInvalidOpcode, 688 }, 689 { 690 name: "OP_DATA_24", 691 pop: &parsedOpcode{ 692 opcode: &opcodeArray[OP_DATA_24], 693 data: make([]byte, 24), 694 }, 695 expectedErr: nil, 696 }, 697 { 698 name: "OP_DATA_24 long", 699 pop: &parsedOpcode{ 700 opcode: &opcodeArray[OP_DATA_24], 701 data: make([]byte, 25), 702 }, 703 expectedErr: ErrStackInvalidOpcode, 704 }, 705 { 706 name: "OP_DATA_25 short", 707 pop: &parsedOpcode{ 708 opcode: &opcodeArray[OP_DATA_25], 709 data: make([]byte, 24), 710 }, 711 expectedErr: ErrStackInvalidOpcode, 712 }, 713 { 714 name: "OP_DATA_25", 715 pop: &parsedOpcode{ 716 opcode: &opcodeArray[OP_DATA_25], 717 data: make([]byte, 25), 718 }, 719 expectedErr: nil, 720 }, 721 { 722 name: "OP_DATA_25 long", 723 pop: &parsedOpcode{ 724 opcode: &opcodeArray[OP_DATA_25], 725 data: make([]byte, 26), 726 }, 727 expectedErr: ErrStackInvalidOpcode, 728 }, 729 { 730 name: "OP_DATA_26 short", 731 pop: &parsedOpcode{ 732 opcode: &opcodeArray[OP_DATA_26], 733 data: make([]byte, 25), 734 }, 735 expectedErr: ErrStackInvalidOpcode, 736 }, 737 { 738 name: "OP_DATA_26", 739 pop: &parsedOpcode{ 740 opcode: &opcodeArray[OP_DATA_26], 741 data: make([]byte, 26), 742 }, 743 expectedErr: nil, 744 }, 745 { 746 name: "OP_DATA_26 long", 747 pop: &parsedOpcode{ 748 opcode: &opcodeArray[OP_DATA_26], 749 data: make([]byte, 27), 750 }, 751 expectedErr: ErrStackInvalidOpcode, 752 }, 753 { 754 name: "OP_DATA_27 short", 755 pop: &parsedOpcode{ 756 opcode: &opcodeArray[OP_DATA_27], 757 data: make([]byte, 26), 758 }, 759 expectedErr: ErrStackInvalidOpcode, 760 }, 761 { 762 name: "OP_DATA_27", 763 pop: &parsedOpcode{ 764 opcode: &opcodeArray[OP_DATA_27], 765 data: make([]byte, 27), 766 }, 767 expectedErr: nil, 768 }, 769 { 770 name: "OP_DATA_27 long", 771 pop: &parsedOpcode{ 772 opcode: &opcodeArray[OP_DATA_27], 773 data: make([]byte, 28), 774 }, 775 expectedErr: ErrStackInvalidOpcode, 776 }, 777 { 778 name: "OP_DATA_28 short", 779 pop: &parsedOpcode{ 780 opcode: &opcodeArray[OP_DATA_28], 781 data: make([]byte, 27), 782 }, 783 expectedErr: ErrStackInvalidOpcode, 784 }, 785 { 786 name: "OP_DATA_28", 787 pop: &parsedOpcode{ 788 opcode: &opcodeArray[OP_DATA_28], 789 data: make([]byte, 28), 790 }, 791 expectedErr: nil, 792 }, 793 { 794 name: "OP_DATA_28 long", 795 pop: &parsedOpcode{ 796 opcode: &opcodeArray[OP_DATA_28], 797 data: make([]byte, 29), 798 }, 799 expectedErr: ErrStackInvalidOpcode, 800 }, 801 { 802 name: "OP_DATA_29 short", 803 pop: &parsedOpcode{ 804 opcode: &opcodeArray[OP_DATA_29], 805 data: make([]byte, 28), 806 }, 807 expectedErr: ErrStackInvalidOpcode, 808 }, 809 { 810 name: "OP_DATA_29", 811 pop: &parsedOpcode{ 812 opcode: &opcodeArray[OP_DATA_29], 813 data: make([]byte, 29), 814 }, 815 expectedErr: nil, 816 }, 817 { 818 name: "OP_DATA_29 long", 819 pop: &parsedOpcode{ 820 opcode: &opcodeArray[OP_DATA_29], 821 data: make([]byte, 30), 822 }, 823 expectedErr: ErrStackInvalidOpcode, 824 }, 825 { 826 name: "OP_DATA_30 short", 827 pop: &parsedOpcode{ 828 opcode: &opcodeArray[OP_DATA_30], 829 data: make([]byte, 29), 830 }, 831 expectedErr: ErrStackInvalidOpcode, 832 }, 833 { 834 name: "OP_DATA_30", 835 pop: &parsedOpcode{ 836 opcode: &opcodeArray[OP_DATA_30], 837 data: make([]byte, 30), 838 }, 839 expectedErr: nil, 840 }, 841 { 842 name: "OP_DATA_30 long", 843 pop: &parsedOpcode{ 844 opcode: &opcodeArray[OP_DATA_30], 845 data: make([]byte, 31), 846 }, 847 expectedErr: ErrStackInvalidOpcode, 848 }, 849 { 850 name: "OP_DATA_31 short", 851 pop: &parsedOpcode{ 852 opcode: &opcodeArray[OP_DATA_31], 853 data: make([]byte, 30), 854 }, 855 expectedErr: ErrStackInvalidOpcode, 856 }, 857 { 858 name: "OP_DATA_31", 859 pop: &parsedOpcode{ 860 opcode: &opcodeArray[OP_DATA_31], 861 data: make([]byte, 31), 862 }, 863 expectedErr: nil, 864 }, 865 { 866 name: "OP_DATA_31 long", 867 pop: &parsedOpcode{ 868 opcode: &opcodeArray[OP_DATA_31], 869 data: make([]byte, 32), 870 }, 871 expectedErr: ErrStackInvalidOpcode, 872 }, 873 { 874 name: "OP_DATA_32 short", 875 pop: &parsedOpcode{ 876 opcode: &opcodeArray[OP_DATA_32], 877 data: make([]byte, 31), 878 }, 879 expectedErr: ErrStackInvalidOpcode, 880 }, 881 { 882 name: "OP_DATA_32", 883 pop: &parsedOpcode{ 884 opcode: &opcodeArray[OP_DATA_32], 885 data: make([]byte, 32), 886 }, 887 expectedErr: nil, 888 }, 889 { 890 name: "OP_DATA_32 long", 891 pop: &parsedOpcode{ 892 opcode: &opcodeArray[OP_DATA_32], 893 data: make([]byte, 33), 894 }, 895 expectedErr: ErrStackInvalidOpcode, 896 }, 897 { 898 name: "OP_DATA_33 short", 899 pop: &parsedOpcode{ 900 opcode: &opcodeArray[OP_DATA_33], 901 data: make([]byte, 32), 902 }, 903 expectedErr: ErrStackInvalidOpcode, 904 }, 905 { 906 name: "OP_DATA_33", 907 pop: &parsedOpcode{ 908 opcode: &opcodeArray[OP_DATA_33], 909 data: make([]byte, 33), 910 }, 911 expectedErr: nil, 912 }, 913 { 914 name: "OP_DATA_33 long", 915 pop: &parsedOpcode{ 916 opcode: &opcodeArray[OP_DATA_33], 917 data: make([]byte, 34), 918 }, 919 expectedErr: ErrStackInvalidOpcode, 920 }, 921 { 922 name: "OP_DATA_34 short", 923 pop: &parsedOpcode{ 924 opcode: &opcodeArray[OP_DATA_34], 925 data: make([]byte, 33), 926 }, 927 expectedErr: ErrStackInvalidOpcode, 928 }, 929 { 930 name: "OP_DATA_34", 931 pop: &parsedOpcode{ 932 opcode: &opcodeArray[OP_DATA_34], 933 data: make([]byte, 34), 934 }, 935 expectedErr: nil, 936 }, 937 { 938 name: "OP_DATA_34 long", 939 pop: &parsedOpcode{ 940 opcode: &opcodeArray[OP_DATA_34], 941 data: make([]byte, 35), 942 }, 943 expectedErr: ErrStackInvalidOpcode, 944 }, 945 { 946 name: "OP_DATA_35 short", 947 pop: &parsedOpcode{ 948 opcode: &opcodeArray[OP_DATA_35], 949 data: make([]byte, 34), 950 }, 951 expectedErr: ErrStackInvalidOpcode, 952 }, 953 { 954 name: "OP_DATA_35", 955 pop: &parsedOpcode{ 956 opcode: &opcodeArray[OP_DATA_35], 957 data: make([]byte, 35), 958 }, 959 expectedErr: nil, 960 }, 961 { 962 name: "OP_DATA_35 long", 963 pop: &parsedOpcode{ 964 opcode: &opcodeArray[OP_DATA_35], 965 data: make([]byte, 36), 966 }, 967 expectedErr: ErrStackInvalidOpcode, 968 }, 969 { 970 name: "OP_DATA_36 short", 971 pop: &parsedOpcode{ 972 opcode: &opcodeArray[OP_DATA_36], 973 data: make([]byte, 35), 974 }, 975 expectedErr: ErrStackInvalidOpcode, 976 }, 977 { 978 name: "OP_DATA_36", 979 pop: &parsedOpcode{ 980 opcode: &opcodeArray[OP_DATA_36], 981 data: make([]byte, 36), 982 }, 983 expectedErr: nil, 984 }, 985 { 986 name: "OP_DATA_36 long", 987 pop: &parsedOpcode{ 988 opcode: &opcodeArray[OP_DATA_36], 989 data: make([]byte, 37), 990 }, 991 expectedErr: ErrStackInvalidOpcode, 992 }, 993 { 994 name: "OP_DATA_37 short", 995 pop: &parsedOpcode{ 996 opcode: &opcodeArray[OP_DATA_37], 997 data: make([]byte, 36), 998 }, 999 expectedErr: ErrStackInvalidOpcode, 1000 }, 1001 { 1002 name: "OP_DATA_37", 1003 pop: &parsedOpcode{ 1004 opcode: &opcodeArray[OP_DATA_37], 1005 data: make([]byte, 37), 1006 }, 1007 expectedErr: nil, 1008 }, 1009 { 1010 name: "OP_DATA_37 long", 1011 pop: &parsedOpcode{ 1012 opcode: &opcodeArray[OP_DATA_37], 1013 data: make([]byte, 38), 1014 }, 1015 expectedErr: ErrStackInvalidOpcode, 1016 }, 1017 { 1018 name: "OP_DATA_38 short", 1019 pop: &parsedOpcode{ 1020 opcode: &opcodeArray[OP_DATA_38], 1021 data: make([]byte, 37), 1022 }, 1023 expectedErr: ErrStackInvalidOpcode, 1024 }, 1025 { 1026 name: "OP_DATA_38", 1027 pop: &parsedOpcode{ 1028 opcode: &opcodeArray[OP_DATA_38], 1029 data: make([]byte, 38), 1030 }, 1031 expectedErr: nil, 1032 }, 1033 { 1034 name: "OP_DATA_38 long", 1035 pop: &parsedOpcode{ 1036 opcode: &opcodeArray[OP_DATA_38], 1037 data: make([]byte, 39), 1038 }, 1039 expectedErr: ErrStackInvalidOpcode, 1040 }, 1041 { 1042 name: "OP_DATA_39 short", 1043 pop: &parsedOpcode{ 1044 opcode: &opcodeArray[OP_DATA_39], 1045 data: make([]byte, 38), 1046 }, 1047 expectedErr: ErrStackInvalidOpcode, 1048 }, 1049 { 1050 name: "OP_DATA_39", 1051 pop: &parsedOpcode{ 1052 opcode: &opcodeArray[OP_DATA_39], 1053 data: make([]byte, 39), 1054 }, 1055 expectedErr: nil, 1056 }, 1057 { 1058 name: "OP_DATA_39 long", 1059 pop: &parsedOpcode{ 1060 opcode: &opcodeArray[OP_DATA_39], 1061 data: make([]byte, 40), 1062 }, 1063 expectedErr: ErrStackInvalidOpcode, 1064 }, 1065 { 1066 name: "OP_DATA_40 short", 1067 pop: &parsedOpcode{ 1068 opcode: &opcodeArray[OP_DATA_40], 1069 data: make([]byte, 39), 1070 }, 1071 expectedErr: ErrStackInvalidOpcode, 1072 }, 1073 { 1074 name: "OP_DATA_40", 1075 pop: &parsedOpcode{ 1076 opcode: &opcodeArray[OP_DATA_40], 1077 data: make([]byte, 40), 1078 }, 1079 expectedErr: nil, 1080 }, 1081 { 1082 name: "OP_DATA_40 long", 1083 pop: &parsedOpcode{ 1084 opcode: &opcodeArray[OP_DATA_40], 1085 data: make([]byte, 41), 1086 }, 1087 expectedErr: ErrStackInvalidOpcode, 1088 }, 1089 { 1090 name: "OP_DATA_41 short", 1091 pop: &parsedOpcode{ 1092 opcode: &opcodeArray[OP_DATA_41], 1093 data: make([]byte, 40), 1094 }, 1095 expectedErr: ErrStackInvalidOpcode, 1096 }, 1097 { 1098 name: "OP_DATA_41", 1099 pop: &parsedOpcode{ 1100 opcode: &opcodeArray[OP_DATA_41], 1101 data: make([]byte, 41), 1102 }, 1103 expectedErr: nil, 1104 }, 1105 { 1106 name: "OP_DATA_41 long", 1107 pop: &parsedOpcode{ 1108 opcode: &opcodeArray[OP_DATA_41], 1109 data: make([]byte, 42), 1110 }, 1111 expectedErr: ErrStackInvalidOpcode, 1112 }, 1113 { 1114 name: "OP_DATA_42 short", 1115 pop: &parsedOpcode{ 1116 opcode: &opcodeArray[OP_DATA_42], 1117 data: make([]byte, 41), 1118 }, 1119 expectedErr: ErrStackInvalidOpcode, 1120 }, 1121 { 1122 name: "OP_DATA_42", 1123 pop: &parsedOpcode{ 1124 opcode: &opcodeArray[OP_DATA_42], 1125 data: make([]byte, 42), 1126 }, 1127 expectedErr: nil, 1128 }, 1129 { 1130 name: "OP_DATA_42 long", 1131 pop: &parsedOpcode{ 1132 opcode: &opcodeArray[OP_DATA_42], 1133 data: make([]byte, 43), 1134 }, 1135 expectedErr: ErrStackInvalidOpcode, 1136 }, 1137 { 1138 name: "OP_DATA_43 short", 1139 pop: &parsedOpcode{ 1140 opcode: &opcodeArray[OP_DATA_43], 1141 data: make([]byte, 42), 1142 }, 1143 expectedErr: ErrStackInvalidOpcode, 1144 }, 1145 { 1146 name: "OP_DATA_43", 1147 pop: &parsedOpcode{ 1148 opcode: &opcodeArray[OP_DATA_43], 1149 data: make([]byte, 43), 1150 }, 1151 expectedErr: nil, 1152 }, 1153 { 1154 name: "OP_DATA_43 long", 1155 pop: &parsedOpcode{ 1156 opcode: &opcodeArray[OP_DATA_43], 1157 data: make([]byte, 44), 1158 }, 1159 expectedErr: ErrStackInvalidOpcode, 1160 }, 1161 { 1162 name: "OP_DATA_44 short", 1163 pop: &parsedOpcode{ 1164 opcode: &opcodeArray[OP_DATA_44], 1165 data: make([]byte, 43), 1166 }, 1167 expectedErr: ErrStackInvalidOpcode, 1168 }, 1169 { 1170 name: "OP_DATA_44", 1171 pop: &parsedOpcode{ 1172 opcode: &opcodeArray[OP_DATA_44], 1173 data: make([]byte, 44), 1174 }, 1175 expectedErr: nil, 1176 }, 1177 { 1178 name: "OP_DATA_44 long", 1179 pop: &parsedOpcode{ 1180 opcode: &opcodeArray[OP_DATA_44], 1181 data: make([]byte, 45), 1182 }, 1183 expectedErr: ErrStackInvalidOpcode, 1184 }, 1185 { 1186 name: "OP_DATA_45 short", 1187 pop: &parsedOpcode{ 1188 opcode: &opcodeArray[OP_DATA_45], 1189 data: make([]byte, 44), 1190 }, 1191 expectedErr: ErrStackInvalidOpcode, 1192 }, 1193 { 1194 name: "OP_DATA_45", 1195 pop: &parsedOpcode{ 1196 opcode: &opcodeArray[OP_DATA_45], 1197 data: make([]byte, 45), 1198 }, 1199 expectedErr: nil, 1200 }, 1201 { 1202 name: "OP_DATA_45 long", 1203 pop: &parsedOpcode{ 1204 opcode: &opcodeArray[OP_DATA_45], 1205 data: make([]byte, 46), 1206 }, 1207 expectedErr: ErrStackInvalidOpcode, 1208 }, 1209 { 1210 name: "OP_DATA_46 short", 1211 pop: &parsedOpcode{ 1212 opcode: &opcodeArray[OP_DATA_46], 1213 data: make([]byte, 45), 1214 }, 1215 expectedErr: ErrStackInvalidOpcode, 1216 }, 1217 { 1218 name: "OP_DATA_46", 1219 pop: &parsedOpcode{ 1220 opcode: &opcodeArray[OP_DATA_46], 1221 data: make([]byte, 46), 1222 }, 1223 expectedErr: nil, 1224 }, 1225 { 1226 name: "OP_DATA_46 long", 1227 pop: &parsedOpcode{ 1228 opcode: &opcodeArray[OP_DATA_46], 1229 data: make([]byte, 47), 1230 }, 1231 expectedErr: ErrStackInvalidOpcode, 1232 }, 1233 { 1234 name: "OP_DATA_47 short", 1235 pop: &parsedOpcode{ 1236 opcode: &opcodeArray[OP_DATA_47], 1237 data: make([]byte, 46), 1238 }, 1239 expectedErr: ErrStackInvalidOpcode, 1240 }, 1241 { 1242 name: "OP_DATA_47", 1243 pop: &parsedOpcode{ 1244 opcode: &opcodeArray[OP_DATA_47], 1245 data: make([]byte, 47), 1246 }, 1247 expectedErr: nil, 1248 }, 1249 { 1250 name: "OP_DATA_47 long", 1251 pop: &parsedOpcode{ 1252 opcode: &opcodeArray[OP_DATA_47], 1253 data: make([]byte, 48), 1254 }, 1255 expectedErr: ErrStackInvalidOpcode, 1256 }, 1257 { 1258 name: "OP_DATA_48 short", 1259 pop: &parsedOpcode{ 1260 opcode: &opcodeArray[OP_DATA_48], 1261 data: make([]byte, 47), 1262 }, 1263 expectedErr: ErrStackInvalidOpcode, 1264 }, 1265 { 1266 name: "OP_DATA_48", 1267 pop: &parsedOpcode{ 1268 opcode: &opcodeArray[OP_DATA_48], 1269 data: make([]byte, 48), 1270 }, 1271 expectedErr: nil, 1272 }, 1273 { 1274 name: "OP_DATA_48 long", 1275 pop: &parsedOpcode{ 1276 opcode: &opcodeArray[OP_DATA_48], 1277 data: make([]byte, 49), 1278 }, 1279 expectedErr: ErrStackInvalidOpcode, 1280 }, 1281 { 1282 name: "OP_DATA_49 short", 1283 pop: &parsedOpcode{ 1284 opcode: &opcodeArray[OP_DATA_49], 1285 data: make([]byte, 48), 1286 }, 1287 expectedErr: ErrStackInvalidOpcode, 1288 }, 1289 { 1290 name: "OP_DATA_49", 1291 pop: &parsedOpcode{ 1292 opcode: &opcodeArray[OP_DATA_49], 1293 data: make([]byte, 49), 1294 }, 1295 expectedErr: nil, 1296 }, 1297 { 1298 name: "OP_DATA_49 long", 1299 pop: &parsedOpcode{ 1300 opcode: &opcodeArray[OP_DATA_49], 1301 data: make([]byte, 50), 1302 }, 1303 expectedErr: ErrStackInvalidOpcode, 1304 }, 1305 { 1306 name: "OP_DATA_50 short", 1307 pop: &parsedOpcode{ 1308 opcode: &opcodeArray[OP_DATA_50], 1309 data: make([]byte, 49), 1310 }, 1311 expectedErr: ErrStackInvalidOpcode, 1312 }, 1313 { 1314 name: "OP_DATA_50", 1315 pop: &parsedOpcode{ 1316 opcode: &opcodeArray[OP_DATA_50], 1317 data: make([]byte, 50), 1318 }, 1319 expectedErr: nil, 1320 }, 1321 { 1322 name: "OP_DATA_50 long", 1323 pop: &parsedOpcode{ 1324 opcode: &opcodeArray[OP_DATA_50], 1325 data: make([]byte, 51), 1326 }, 1327 expectedErr: ErrStackInvalidOpcode, 1328 }, 1329 { 1330 name: "OP_DATA_51 short", 1331 pop: &parsedOpcode{ 1332 opcode: &opcodeArray[OP_DATA_51], 1333 data: make([]byte, 50), 1334 }, 1335 expectedErr: ErrStackInvalidOpcode, 1336 }, 1337 { 1338 name: "OP_DATA_51", 1339 pop: &parsedOpcode{ 1340 opcode: &opcodeArray[OP_DATA_51], 1341 data: make([]byte, 51), 1342 }, 1343 expectedErr: nil, 1344 }, 1345 { 1346 name: "OP_DATA_51 long", 1347 pop: &parsedOpcode{ 1348 opcode: &opcodeArray[OP_DATA_51], 1349 data: make([]byte, 52), 1350 }, 1351 expectedErr: ErrStackInvalidOpcode, 1352 }, 1353 { 1354 name: "OP_DATA_52 short", 1355 pop: &parsedOpcode{ 1356 opcode: &opcodeArray[OP_DATA_52], 1357 data: make([]byte, 51), 1358 }, 1359 expectedErr: ErrStackInvalidOpcode, 1360 }, 1361 { 1362 name: "OP_DATA_52", 1363 pop: &parsedOpcode{ 1364 opcode: &opcodeArray[OP_DATA_52], 1365 data: make([]byte, 52), 1366 }, 1367 expectedErr: nil, 1368 }, 1369 { 1370 name: "OP_DATA_52 long", 1371 pop: &parsedOpcode{ 1372 opcode: &opcodeArray[OP_DATA_52], 1373 data: make([]byte, 53), 1374 }, 1375 expectedErr: ErrStackInvalidOpcode, 1376 }, 1377 { 1378 name: "OP_DATA_53 short", 1379 pop: &parsedOpcode{ 1380 opcode: &opcodeArray[OP_DATA_53], 1381 data: make([]byte, 52), 1382 }, 1383 expectedErr: ErrStackInvalidOpcode, 1384 }, 1385 { 1386 name: "OP_DATA_53", 1387 pop: &parsedOpcode{ 1388 opcode: &opcodeArray[OP_DATA_53], 1389 data: make([]byte, 53), 1390 }, 1391 expectedErr: nil, 1392 }, 1393 { 1394 name: "OP_DATA_53 long", 1395 pop: &parsedOpcode{ 1396 opcode: &opcodeArray[OP_DATA_53], 1397 data: make([]byte, 54), 1398 }, 1399 expectedErr: ErrStackInvalidOpcode, 1400 }, 1401 { 1402 name: "OP_DATA_54 short", 1403 pop: &parsedOpcode{ 1404 opcode: &opcodeArray[OP_DATA_54], 1405 data: make([]byte, 53), 1406 }, 1407 expectedErr: ErrStackInvalidOpcode, 1408 }, 1409 { 1410 name: "OP_DATA_54", 1411 pop: &parsedOpcode{ 1412 opcode: &opcodeArray[OP_DATA_54], 1413 data: make([]byte, 54), 1414 }, 1415 expectedErr: nil, 1416 }, 1417 { 1418 name: "OP_DATA_54 long", 1419 pop: &parsedOpcode{ 1420 opcode: &opcodeArray[OP_DATA_54], 1421 data: make([]byte, 55), 1422 }, 1423 expectedErr: ErrStackInvalidOpcode, 1424 }, 1425 { 1426 name: "OP_DATA_55 short", 1427 pop: &parsedOpcode{ 1428 opcode: &opcodeArray[OP_DATA_55], 1429 data: make([]byte, 54), 1430 }, 1431 expectedErr: ErrStackInvalidOpcode, 1432 }, 1433 { 1434 name: "OP_DATA_55", 1435 pop: &parsedOpcode{ 1436 opcode: &opcodeArray[OP_DATA_55], 1437 data: make([]byte, 55), 1438 }, 1439 expectedErr: nil, 1440 }, 1441 { 1442 name: "OP_DATA_55 long", 1443 pop: &parsedOpcode{ 1444 opcode: &opcodeArray[OP_DATA_55], 1445 data: make([]byte, 56), 1446 }, 1447 expectedErr: ErrStackInvalidOpcode, 1448 }, 1449 { 1450 name: "OP_DATA_56 short", 1451 pop: &parsedOpcode{ 1452 opcode: &opcodeArray[OP_DATA_56], 1453 data: make([]byte, 55), 1454 }, 1455 expectedErr: ErrStackInvalidOpcode, 1456 }, 1457 { 1458 name: "OP_DATA_56", 1459 pop: &parsedOpcode{ 1460 opcode: &opcodeArray[OP_DATA_56], 1461 data: make([]byte, 56), 1462 }, 1463 expectedErr: nil, 1464 }, 1465 { 1466 name: "OP_DATA_56 long", 1467 pop: &parsedOpcode{ 1468 opcode: &opcodeArray[OP_DATA_56], 1469 data: make([]byte, 57), 1470 }, 1471 expectedErr: ErrStackInvalidOpcode, 1472 }, 1473 { 1474 name: "OP_DATA_57 short", 1475 pop: &parsedOpcode{ 1476 opcode: &opcodeArray[OP_DATA_57], 1477 data: make([]byte, 56), 1478 }, 1479 expectedErr: ErrStackInvalidOpcode, 1480 }, 1481 { 1482 name: "OP_DATA_57", 1483 pop: &parsedOpcode{ 1484 opcode: &opcodeArray[OP_DATA_57], 1485 data: make([]byte, 57), 1486 }, 1487 expectedErr: nil, 1488 }, 1489 { 1490 name: "OP_DATA_57 long", 1491 pop: &parsedOpcode{ 1492 opcode: &opcodeArray[OP_DATA_57], 1493 data: make([]byte, 58), 1494 }, 1495 expectedErr: ErrStackInvalidOpcode, 1496 }, 1497 { 1498 name: "OP_DATA_58 short", 1499 pop: &parsedOpcode{ 1500 opcode: &opcodeArray[OP_DATA_58], 1501 data: make([]byte, 57), 1502 }, 1503 expectedErr: ErrStackInvalidOpcode, 1504 }, 1505 { 1506 name: "OP_DATA_58", 1507 pop: &parsedOpcode{ 1508 opcode: &opcodeArray[OP_DATA_58], 1509 data: make([]byte, 58), 1510 }, 1511 expectedErr: nil, 1512 }, 1513 { 1514 name: "OP_DATA_58 long", 1515 pop: &parsedOpcode{ 1516 opcode: &opcodeArray[OP_DATA_58], 1517 data: make([]byte, 59), 1518 }, 1519 expectedErr: ErrStackInvalidOpcode, 1520 }, 1521 { 1522 name: "OP_DATA_59 short", 1523 pop: &parsedOpcode{ 1524 opcode: &opcodeArray[OP_DATA_59], 1525 data: make([]byte, 58), 1526 }, 1527 expectedErr: ErrStackInvalidOpcode, 1528 }, 1529 { 1530 name: "OP_DATA_59", 1531 pop: &parsedOpcode{ 1532 opcode: &opcodeArray[OP_DATA_59], 1533 data: make([]byte, 59), 1534 }, 1535 expectedErr: nil, 1536 }, 1537 { 1538 name: "OP_DATA_59 long", 1539 pop: &parsedOpcode{ 1540 opcode: &opcodeArray[OP_DATA_59], 1541 data: make([]byte, 60), 1542 }, 1543 expectedErr: ErrStackInvalidOpcode, 1544 }, 1545 { 1546 name: "OP_DATA_60 short", 1547 pop: &parsedOpcode{ 1548 opcode: &opcodeArray[OP_DATA_60], 1549 data: make([]byte, 59), 1550 }, 1551 expectedErr: ErrStackInvalidOpcode, 1552 }, 1553 { 1554 name: "OP_DATA_60", 1555 pop: &parsedOpcode{ 1556 opcode: &opcodeArray[OP_DATA_60], 1557 data: make([]byte, 60), 1558 }, 1559 expectedErr: nil, 1560 }, 1561 { 1562 name: "OP_DATA_60 long", 1563 pop: &parsedOpcode{ 1564 opcode: &opcodeArray[OP_DATA_60], 1565 data: make([]byte, 61), 1566 }, 1567 expectedErr: ErrStackInvalidOpcode, 1568 }, 1569 { 1570 name: "OP_DATA_61 short", 1571 pop: &parsedOpcode{ 1572 opcode: &opcodeArray[OP_DATA_61], 1573 data: make([]byte, 60), 1574 }, 1575 expectedErr: ErrStackInvalidOpcode, 1576 }, 1577 { 1578 name: "OP_DATA_61", 1579 pop: &parsedOpcode{ 1580 opcode: &opcodeArray[OP_DATA_61], 1581 data: make([]byte, 61), 1582 }, 1583 expectedErr: nil, 1584 }, 1585 { 1586 name: "OP_DATA_61 long", 1587 pop: &parsedOpcode{ 1588 opcode: &opcodeArray[OP_DATA_61], 1589 data: make([]byte, 62), 1590 }, 1591 expectedErr: ErrStackInvalidOpcode, 1592 }, 1593 { 1594 name: "OP_DATA_62 short", 1595 pop: &parsedOpcode{ 1596 opcode: &opcodeArray[OP_DATA_62], 1597 data: make([]byte, 61), 1598 }, 1599 expectedErr: ErrStackInvalidOpcode, 1600 }, 1601 { 1602 name: "OP_DATA_62", 1603 pop: &parsedOpcode{ 1604 opcode: &opcodeArray[OP_DATA_62], 1605 data: make([]byte, 62), 1606 }, 1607 expectedErr: nil, 1608 }, 1609 { 1610 name: "OP_DATA_62 long", 1611 pop: &parsedOpcode{ 1612 opcode: &opcodeArray[OP_DATA_62], 1613 data: make([]byte, 63), 1614 }, 1615 expectedErr: ErrStackInvalidOpcode, 1616 }, 1617 { 1618 name: "OP_DATA_63 short", 1619 pop: &parsedOpcode{ 1620 opcode: &opcodeArray[OP_DATA_63], 1621 data: make([]byte, 62), 1622 }, 1623 expectedErr: ErrStackInvalidOpcode, 1624 }, 1625 { 1626 name: "OP_DATA_63", 1627 pop: &parsedOpcode{ 1628 opcode: &opcodeArray[OP_DATA_63], 1629 data: make([]byte, 63), 1630 }, 1631 expectedErr: nil, 1632 }, 1633 { 1634 name: "OP_DATA_63 long", 1635 pop: &parsedOpcode{ 1636 opcode: &opcodeArray[OP_DATA_63], 1637 data: make([]byte, 64), 1638 }, 1639 expectedErr: ErrStackInvalidOpcode, 1640 }, 1641 { 1642 name: "OP_DATA_64 short", 1643 pop: &parsedOpcode{ 1644 opcode: &opcodeArray[OP_DATA_64], 1645 data: make([]byte, 63), 1646 }, 1647 expectedErr: ErrStackInvalidOpcode, 1648 }, 1649 { 1650 name: "OP_DATA_64", 1651 pop: &parsedOpcode{ 1652 opcode: &opcodeArray[OP_DATA_64], 1653 data: make([]byte, 64), 1654 }, 1655 expectedErr: nil, 1656 }, 1657 { 1658 name: "OP_DATA_64 long", 1659 pop: &parsedOpcode{ 1660 opcode: &opcodeArray[OP_DATA_64], 1661 data: make([]byte, 65), 1662 }, 1663 expectedErr: ErrStackInvalidOpcode, 1664 }, 1665 { 1666 name: "OP_DATA_65 short", 1667 pop: &parsedOpcode{ 1668 opcode: &opcodeArray[OP_DATA_65], 1669 data: make([]byte, 64), 1670 }, 1671 expectedErr: ErrStackInvalidOpcode, 1672 }, 1673 { 1674 name: "OP_DATA_65", 1675 pop: &parsedOpcode{ 1676 opcode: &opcodeArray[OP_DATA_65], 1677 data: make([]byte, 65), 1678 }, 1679 expectedErr: nil, 1680 }, 1681 { 1682 name: "OP_DATA_65 long", 1683 pop: &parsedOpcode{ 1684 opcode: &opcodeArray[OP_DATA_65], 1685 data: make([]byte, 66), 1686 }, 1687 expectedErr: ErrStackInvalidOpcode, 1688 }, 1689 { 1690 name: "OP_DATA_66 short", 1691 pop: &parsedOpcode{ 1692 opcode: &opcodeArray[OP_DATA_66], 1693 data: make([]byte, 65), 1694 }, 1695 expectedErr: ErrStackInvalidOpcode, 1696 }, 1697 { 1698 name: "OP_DATA_66", 1699 pop: &parsedOpcode{ 1700 opcode: &opcodeArray[OP_DATA_66], 1701 data: make([]byte, 66), 1702 }, 1703 expectedErr: nil, 1704 }, 1705 { 1706 name: "OP_DATA_66 long", 1707 pop: &parsedOpcode{ 1708 opcode: &opcodeArray[OP_DATA_66], 1709 data: make([]byte, 67), 1710 }, 1711 expectedErr: ErrStackInvalidOpcode, 1712 }, 1713 { 1714 name: "OP_DATA_67 short", 1715 pop: &parsedOpcode{ 1716 opcode: &opcodeArray[OP_DATA_67], 1717 data: make([]byte, 66), 1718 }, 1719 expectedErr: ErrStackInvalidOpcode, 1720 }, 1721 { 1722 name: "OP_DATA_67", 1723 pop: &parsedOpcode{ 1724 opcode: &opcodeArray[OP_DATA_67], 1725 data: make([]byte, 67), 1726 }, 1727 expectedErr: nil, 1728 }, 1729 { 1730 name: "OP_DATA_67 long", 1731 pop: &parsedOpcode{ 1732 opcode: &opcodeArray[OP_DATA_67], 1733 data: make([]byte, 68), 1734 }, 1735 expectedErr: ErrStackInvalidOpcode, 1736 }, 1737 { 1738 name: "OP_DATA_68 short", 1739 pop: &parsedOpcode{ 1740 opcode: &opcodeArray[OP_DATA_68], 1741 data: make([]byte, 67), 1742 }, 1743 expectedErr: ErrStackInvalidOpcode, 1744 }, 1745 { 1746 name: "OP_DATA_68", 1747 pop: &parsedOpcode{ 1748 opcode: &opcodeArray[OP_DATA_68], 1749 data: make([]byte, 68), 1750 }, 1751 expectedErr: nil, 1752 }, 1753 { 1754 name: "OP_DATA_68 long", 1755 pop: &parsedOpcode{ 1756 opcode: &opcodeArray[OP_DATA_68], 1757 data: make([]byte, 69), 1758 }, 1759 expectedErr: ErrStackInvalidOpcode, 1760 }, 1761 { 1762 name: "OP_DATA_69 short", 1763 pop: &parsedOpcode{ 1764 opcode: &opcodeArray[OP_DATA_69], 1765 data: make([]byte, 68), 1766 }, 1767 expectedErr: ErrStackInvalidOpcode, 1768 }, 1769 { 1770 name: "OP_DATA_69", 1771 pop: &parsedOpcode{ 1772 opcode: &opcodeArray[OP_DATA_69], 1773 data: make([]byte, 69), 1774 }, 1775 expectedErr: nil, 1776 }, 1777 { 1778 name: "OP_DATA_69 long", 1779 pop: &parsedOpcode{ 1780 opcode: &opcodeArray[OP_DATA_69], 1781 data: make([]byte, 70), 1782 }, 1783 expectedErr: ErrStackInvalidOpcode, 1784 }, 1785 { 1786 name: "OP_DATA_70 short", 1787 pop: &parsedOpcode{ 1788 opcode: &opcodeArray[OP_DATA_70], 1789 data: make([]byte, 69), 1790 }, 1791 expectedErr: ErrStackInvalidOpcode, 1792 }, 1793 { 1794 name: "OP_DATA_70", 1795 pop: &parsedOpcode{ 1796 opcode: &opcodeArray[OP_DATA_70], 1797 data: make([]byte, 70), 1798 }, 1799 expectedErr: nil, 1800 }, 1801 { 1802 name: "OP_DATA_70 long", 1803 pop: &parsedOpcode{ 1804 opcode: &opcodeArray[OP_DATA_70], 1805 data: make([]byte, 71), 1806 }, 1807 expectedErr: ErrStackInvalidOpcode, 1808 }, 1809 { 1810 name: "OP_DATA_71 short", 1811 pop: &parsedOpcode{ 1812 opcode: &opcodeArray[OP_DATA_71], 1813 data: make([]byte, 70), 1814 }, 1815 expectedErr: ErrStackInvalidOpcode, 1816 }, 1817 { 1818 name: "OP_DATA_71", 1819 pop: &parsedOpcode{ 1820 opcode: &opcodeArray[OP_DATA_71], 1821 data: make([]byte, 71), 1822 }, 1823 expectedErr: nil, 1824 }, 1825 { 1826 name: "OP_DATA_71 long", 1827 pop: &parsedOpcode{ 1828 opcode: &opcodeArray[OP_DATA_71], 1829 data: make([]byte, 72), 1830 }, 1831 expectedErr: ErrStackInvalidOpcode, 1832 }, 1833 { 1834 name: "OP_DATA_72 short", 1835 pop: &parsedOpcode{ 1836 opcode: &opcodeArray[OP_DATA_72], 1837 data: make([]byte, 71), 1838 }, 1839 expectedErr: ErrStackInvalidOpcode, 1840 }, 1841 { 1842 name: "OP_DATA_72", 1843 pop: &parsedOpcode{ 1844 opcode: &opcodeArray[OP_DATA_72], 1845 data: make([]byte, 72), 1846 }, 1847 expectedErr: nil, 1848 }, 1849 { 1850 name: "OP_DATA_72 long", 1851 pop: &parsedOpcode{ 1852 opcode: &opcodeArray[OP_DATA_72], 1853 data: make([]byte, 73), 1854 }, 1855 expectedErr: ErrStackInvalidOpcode, 1856 }, 1857 { 1858 name: "OP_DATA_73 short", 1859 pop: &parsedOpcode{ 1860 opcode: &opcodeArray[OP_DATA_73], 1861 data: make([]byte, 72), 1862 }, 1863 expectedErr: ErrStackInvalidOpcode, 1864 }, 1865 { 1866 name: "OP_DATA_73", 1867 pop: &parsedOpcode{ 1868 opcode: &opcodeArray[OP_DATA_73], 1869 data: make([]byte, 73), 1870 }, 1871 expectedErr: nil, 1872 }, 1873 { 1874 name: "OP_DATA_73 long", 1875 pop: &parsedOpcode{ 1876 opcode: &opcodeArray[OP_DATA_73], 1877 data: make([]byte, 74), 1878 }, 1879 expectedErr: ErrStackInvalidOpcode, 1880 }, 1881 { 1882 name: "OP_DATA_74 short", 1883 pop: &parsedOpcode{ 1884 opcode: &opcodeArray[OP_DATA_74], 1885 data: make([]byte, 73), 1886 }, 1887 expectedErr: ErrStackInvalidOpcode, 1888 }, 1889 { 1890 name: "OP_DATA_74", 1891 pop: &parsedOpcode{ 1892 opcode: &opcodeArray[OP_DATA_74], 1893 data: make([]byte, 74), 1894 }, 1895 expectedErr: nil, 1896 }, 1897 { 1898 name: "OP_DATA_74 long", 1899 pop: &parsedOpcode{ 1900 opcode: &opcodeArray[OP_DATA_74], 1901 data: make([]byte, 75), 1902 }, 1903 expectedErr: ErrStackInvalidOpcode, 1904 }, 1905 { 1906 name: "OP_DATA_75 short", 1907 pop: &parsedOpcode{ 1908 opcode: &opcodeArray[OP_DATA_75], 1909 data: make([]byte, 74), 1910 }, 1911 expectedErr: ErrStackInvalidOpcode, 1912 }, 1913 { 1914 name: "OP_DATA_75", 1915 pop: &parsedOpcode{ 1916 opcode: &opcodeArray[OP_DATA_75], 1917 data: make([]byte, 75), 1918 }, 1919 expectedErr: nil, 1920 }, 1921 { 1922 name: "OP_DATA_75 long", 1923 pop: &parsedOpcode{ 1924 opcode: &opcodeArray[OP_DATA_75], 1925 data: make([]byte, 76), 1926 }, 1927 expectedErr: ErrStackInvalidOpcode, 1928 }, 1929 { 1930 name: "OP_PUSHDATA1", 1931 pop: &parsedOpcode{ 1932 opcode: &opcodeArray[OP_PUSHDATA1], 1933 data: []byte{0, 1, 2, 3, 4}, 1934 }, 1935 expectedErr: nil, 1936 }, 1937 { 1938 name: "OP_PUSHDATA2", 1939 pop: &parsedOpcode{ 1940 opcode: &opcodeArray[OP_PUSHDATA2], 1941 data: []byte{0, 1, 2, 3, 4}, 1942 }, 1943 expectedErr: nil, 1944 }, 1945 { 1946 name: "OP_PUSHDATA4", 1947 pop: &parsedOpcode{ 1948 opcode: &opcodeArray[OP_PUSHDATA1], 1949 data: []byte{0, 1, 2, 3, 4}, 1950 }, 1951 expectedErr: nil, 1952 }, 1953 { 1954 name: "OP_1NEGATE", 1955 pop: &parsedOpcode{ 1956 opcode: &opcodeArray[OP_1NEGATE], 1957 data: nil, 1958 }, 1959 expectedErr: nil, 1960 }, 1961 { 1962 name: "OP_1NEGATE long", 1963 pop: &parsedOpcode{ 1964 opcode: &opcodeArray[OP_1NEGATE], 1965 data: make([]byte, 1), 1966 }, 1967 expectedErr: ErrStackInvalidOpcode, 1968 }, 1969 { 1970 name: "OP_RESERVED", 1971 pop: &parsedOpcode{ 1972 opcode: &opcodeArray[OP_RESERVED], 1973 data: nil, 1974 }, 1975 expectedErr: nil, 1976 }, 1977 { 1978 name: "OP_RESERVED long", 1979 pop: &parsedOpcode{ 1980 opcode: &opcodeArray[OP_RESERVED], 1981 data: make([]byte, 1), 1982 }, 1983 expectedErr: ErrStackInvalidOpcode, 1984 }, 1985 { 1986 name: "OP_TRUE", 1987 pop: &parsedOpcode{ 1988 opcode: &opcodeArray[OP_TRUE], 1989 data: nil, 1990 }, 1991 expectedErr: nil, 1992 }, 1993 { 1994 name: "OP_TRUE long", 1995 pop: &parsedOpcode{ 1996 opcode: &opcodeArray[OP_TRUE], 1997 data: make([]byte, 1), 1998 }, 1999 expectedErr: ErrStackInvalidOpcode, 2000 }, 2001 { 2002 name: "OP_2", 2003 pop: &parsedOpcode{ 2004 opcode: &opcodeArray[OP_2], 2005 data: nil, 2006 }, 2007 expectedErr: nil, 2008 }, 2009 { 2010 name: "OP_2 long", 2011 pop: &parsedOpcode{ 2012 opcode: &opcodeArray[OP_2], 2013 data: make([]byte, 1), 2014 }, 2015 expectedErr: ErrStackInvalidOpcode, 2016 }, 2017 { 2018 name: "OP_2", 2019 pop: &parsedOpcode{ 2020 opcode: &opcodeArray[OP_2], 2021 data: nil, 2022 }, 2023 expectedErr: nil, 2024 }, 2025 { 2026 name: "OP_2 long", 2027 pop: &parsedOpcode{ 2028 opcode: &opcodeArray[OP_2], 2029 data: make([]byte, 1), 2030 }, 2031 expectedErr: ErrStackInvalidOpcode, 2032 }, 2033 { 2034 name: "OP_3", 2035 pop: &parsedOpcode{ 2036 opcode: &opcodeArray[OP_3], 2037 data: nil, 2038 }, 2039 expectedErr: nil, 2040 }, 2041 { 2042 name: "OP_3 long", 2043 pop: &parsedOpcode{ 2044 opcode: &opcodeArray[OP_3], 2045 data: make([]byte, 1), 2046 }, 2047 expectedErr: ErrStackInvalidOpcode, 2048 }, 2049 { 2050 name: "OP_4", 2051 pop: &parsedOpcode{ 2052 opcode: &opcodeArray[OP_4], 2053 data: nil, 2054 }, 2055 expectedErr: nil, 2056 }, 2057 { 2058 name: "OP_4 long", 2059 pop: &parsedOpcode{ 2060 opcode: &opcodeArray[OP_4], 2061 data: make([]byte, 1), 2062 }, 2063 expectedErr: ErrStackInvalidOpcode, 2064 }, 2065 { 2066 name: "OP_5", 2067 pop: &parsedOpcode{ 2068 opcode: &opcodeArray[OP_5], 2069 data: nil, 2070 }, 2071 expectedErr: nil, 2072 }, 2073 { 2074 name: "OP_5 long", 2075 pop: &parsedOpcode{ 2076 opcode: &opcodeArray[OP_5], 2077 data: make([]byte, 1), 2078 }, 2079 expectedErr: ErrStackInvalidOpcode, 2080 }, 2081 { 2082 name: "OP_6", 2083 pop: &parsedOpcode{ 2084 opcode: &opcodeArray[OP_6], 2085 data: nil, 2086 }, 2087 expectedErr: nil, 2088 }, 2089 { 2090 name: "OP_6 long", 2091 pop: &parsedOpcode{ 2092 opcode: &opcodeArray[OP_6], 2093 data: make([]byte, 1), 2094 }, 2095 expectedErr: ErrStackInvalidOpcode, 2096 }, 2097 { 2098 name: "OP_7", 2099 pop: &parsedOpcode{ 2100 opcode: &opcodeArray[OP_7], 2101 data: nil, 2102 }, 2103 expectedErr: nil, 2104 }, 2105 { 2106 name: "OP_7 long", 2107 pop: &parsedOpcode{ 2108 opcode: &opcodeArray[OP_7], 2109 data: make([]byte, 1), 2110 }, 2111 expectedErr: ErrStackInvalidOpcode, 2112 }, 2113 { 2114 name: "OP_8", 2115 pop: &parsedOpcode{ 2116 opcode: &opcodeArray[OP_8], 2117 data: nil, 2118 }, 2119 expectedErr: nil, 2120 }, 2121 { 2122 name: "OP_8 long", 2123 pop: &parsedOpcode{ 2124 opcode: &opcodeArray[OP_8], 2125 data: make([]byte, 1), 2126 }, 2127 expectedErr: ErrStackInvalidOpcode, 2128 }, 2129 { 2130 name: "OP_9", 2131 pop: &parsedOpcode{ 2132 opcode: &opcodeArray[OP_9], 2133 data: nil, 2134 }, 2135 expectedErr: nil, 2136 }, 2137 { 2138 name: "OP_9 long", 2139 pop: &parsedOpcode{ 2140 opcode: &opcodeArray[OP_9], 2141 data: make([]byte, 1), 2142 }, 2143 expectedErr: ErrStackInvalidOpcode, 2144 }, 2145 { 2146 name: "OP_10", 2147 pop: &parsedOpcode{ 2148 opcode: &opcodeArray[OP_10], 2149 data: nil, 2150 }, 2151 expectedErr: nil, 2152 }, 2153 { 2154 name: "OP_10 long", 2155 pop: &parsedOpcode{ 2156 opcode: &opcodeArray[OP_10], 2157 data: make([]byte, 1), 2158 }, 2159 expectedErr: ErrStackInvalidOpcode, 2160 }, 2161 { 2162 name: "OP_11", 2163 pop: &parsedOpcode{ 2164 opcode: &opcodeArray[OP_11], 2165 data: nil, 2166 }, 2167 expectedErr: nil, 2168 }, 2169 { 2170 name: "OP_11 long", 2171 pop: &parsedOpcode{ 2172 opcode: &opcodeArray[OP_11], 2173 data: make([]byte, 1), 2174 }, 2175 expectedErr: ErrStackInvalidOpcode, 2176 }, 2177 { 2178 name: "OP_12", 2179 pop: &parsedOpcode{ 2180 opcode: &opcodeArray[OP_12], 2181 data: nil, 2182 }, 2183 expectedErr: nil, 2184 }, 2185 { 2186 name: "OP_12 long", 2187 pop: &parsedOpcode{ 2188 opcode: &opcodeArray[OP_12], 2189 data: make([]byte, 1), 2190 }, 2191 expectedErr: ErrStackInvalidOpcode, 2192 }, 2193 { 2194 name: "OP_13", 2195 pop: &parsedOpcode{ 2196 opcode: &opcodeArray[OP_13], 2197 data: nil, 2198 }, 2199 expectedErr: nil, 2200 }, 2201 { 2202 name: "OP_13 long", 2203 pop: &parsedOpcode{ 2204 opcode: &opcodeArray[OP_13], 2205 data: make([]byte, 1), 2206 }, 2207 expectedErr: ErrStackInvalidOpcode, 2208 }, 2209 { 2210 name: "OP_14", 2211 pop: &parsedOpcode{ 2212 opcode: &opcodeArray[OP_14], 2213 data: nil, 2214 }, 2215 expectedErr: nil, 2216 }, 2217 { 2218 name: "OP_14 long", 2219 pop: &parsedOpcode{ 2220 opcode: &opcodeArray[OP_14], 2221 data: make([]byte, 1), 2222 }, 2223 expectedErr: ErrStackInvalidOpcode, 2224 }, 2225 { 2226 name: "OP_15", 2227 pop: &parsedOpcode{ 2228 opcode: &opcodeArray[OP_15], 2229 data: nil, 2230 }, 2231 expectedErr: nil, 2232 }, 2233 { 2234 name: "OP_15 long", 2235 pop: &parsedOpcode{ 2236 opcode: &opcodeArray[OP_15], 2237 data: make([]byte, 1), 2238 }, 2239 expectedErr: ErrStackInvalidOpcode, 2240 }, 2241 { 2242 name: "OP_16", 2243 pop: &parsedOpcode{ 2244 opcode: &opcodeArray[OP_16], 2245 data: nil, 2246 }, 2247 expectedErr: nil, 2248 }, 2249 { 2250 name: "OP_16 long", 2251 pop: &parsedOpcode{ 2252 opcode: &opcodeArray[OP_16], 2253 data: make([]byte, 1), 2254 }, 2255 expectedErr: ErrStackInvalidOpcode, 2256 }, 2257 { 2258 name: "OP_NOP", 2259 pop: &parsedOpcode{ 2260 opcode: &opcodeArray[OP_NOP], 2261 data: nil, 2262 }, 2263 expectedErr: nil, 2264 }, 2265 { 2266 name: "OP_NOP long", 2267 pop: &parsedOpcode{ 2268 opcode: &opcodeArray[OP_NOP], 2269 data: make([]byte, 1), 2270 }, 2271 expectedErr: ErrStackInvalidOpcode, 2272 }, 2273 { 2274 name: "OP_VER", 2275 pop: &parsedOpcode{ 2276 opcode: &opcodeArray[OP_VER], 2277 data: nil, 2278 }, 2279 expectedErr: nil, 2280 }, 2281 { 2282 name: "OP_VER long", 2283 pop: &parsedOpcode{ 2284 opcode: &opcodeArray[OP_VER], 2285 data: make([]byte, 1), 2286 }, 2287 expectedErr: ErrStackInvalidOpcode, 2288 }, 2289 { 2290 name: "OP_IF", 2291 pop: &parsedOpcode{ 2292 opcode: &opcodeArray[OP_IF], 2293 data: nil, 2294 }, 2295 expectedErr: nil, 2296 }, 2297 { 2298 name: "OP_IF long", 2299 pop: &parsedOpcode{ 2300 opcode: &opcodeArray[OP_IF], 2301 data: make([]byte, 1), 2302 }, 2303 expectedErr: ErrStackInvalidOpcode, 2304 }, 2305 { 2306 name: "OP_NOTIF", 2307 pop: &parsedOpcode{ 2308 opcode: &opcodeArray[OP_NOTIF], 2309 data: nil, 2310 }, 2311 expectedErr: nil, 2312 }, 2313 { 2314 name: "OP_NOTIF long", 2315 pop: &parsedOpcode{ 2316 opcode: &opcodeArray[OP_NOTIF], 2317 data: make([]byte, 1), 2318 }, 2319 expectedErr: ErrStackInvalidOpcode, 2320 }, 2321 { 2322 name: "OP_VERIF", 2323 pop: &parsedOpcode{ 2324 opcode: &opcodeArray[OP_VERIF], 2325 data: nil, 2326 }, 2327 expectedErr: nil, 2328 }, 2329 { 2330 name: "OP_VERIF long", 2331 pop: &parsedOpcode{ 2332 opcode: &opcodeArray[OP_VERIF], 2333 data: make([]byte, 1), 2334 }, 2335 expectedErr: ErrStackInvalidOpcode, 2336 }, 2337 { 2338 name: "OP_VERNOTIF", 2339 pop: &parsedOpcode{ 2340 opcode: &opcodeArray[OP_VERNOTIF], 2341 data: nil, 2342 }, 2343 expectedErr: nil, 2344 }, 2345 { 2346 name: "OP_VERNOTIF long", 2347 pop: &parsedOpcode{ 2348 opcode: &opcodeArray[OP_VERNOTIF], 2349 data: make([]byte, 1), 2350 }, 2351 expectedErr: ErrStackInvalidOpcode, 2352 }, 2353 { 2354 name: "OP_ELSE", 2355 pop: &parsedOpcode{ 2356 opcode: &opcodeArray[OP_ELSE], 2357 data: nil, 2358 }, 2359 expectedErr: nil, 2360 }, 2361 { 2362 name: "OP_ELSE long", 2363 pop: &parsedOpcode{ 2364 opcode: &opcodeArray[OP_ELSE], 2365 data: make([]byte, 1), 2366 }, 2367 expectedErr: ErrStackInvalidOpcode, 2368 }, 2369 { 2370 name: "OP_ENDIF", 2371 pop: &parsedOpcode{ 2372 opcode: &opcodeArray[OP_ENDIF], 2373 data: nil, 2374 }, 2375 expectedErr: nil, 2376 }, 2377 { 2378 name: "OP_ENDIF long", 2379 pop: &parsedOpcode{ 2380 opcode: &opcodeArray[OP_ENDIF], 2381 data: make([]byte, 1), 2382 }, 2383 expectedErr: ErrStackInvalidOpcode, 2384 }, 2385 { 2386 name: "OP_VERIFY", 2387 pop: &parsedOpcode{ 2388 opcode: &opcodeArray[OP_VERIFY], 2389 data: nil, 2390 }, 2391 expectedErr: nil, 2392 }, 2393 { 2394 name: "OP_VERIFY long", 2395 pop: &parsedOpcode{ 2396 opcode: &opcodeArray[OP_VERIFY], 2397 data: make([]byte, 1), 2398 }, 2399 expectedErr: ErrStackInvalidOpcode, 2400 }, 2401 { 2402 name: "OP_RETURN", 2403 pop: &parsedOpcode{ 2404 opcode: &opcodeArray[OP_RETURN], 2405 data: nil, 2406 }, 2407 expectedErr: nil, 2408 }, 2409 { 2410 name: "OP_RETURN long", 2411 pop: &parsedOpcode{ 2412 opcode: &opcodeArray[OP_RETURN], 2413 data: make([]byte, 1), 2414 }, 2415 expectedErr: ErrStackInvalidOpcode, 2416 }, 2417 { 2418 name: "OP_TOALTSTACK", 2419 pop: &parsedOpcode{ 2420 opcode: &opcodeArray[OP_TOALTSTACK], 2421 data: nil, 2422 }, 2423 expectedErr: nil, 2424 }, 2425 { 2426 name: "OP_TOALTSTACK long", 2427 pop: &parsedOpcode{ 2428 opcode: &opcodeArray[OP_TOALTSTACK], 2429 data: make([]byte, 1), 2430 }, 2431 expectedErr: ErrStackInvalidOpcode, 2432 }, 2433 { 2434 name: "OP_FROMALTSTACK", 2435 pop: &parsedOpcode{ 2436 opcode: &opcodeArray[OP_FROMALTSTACK], 2437 data: nil, 2438 }, 2439 expectedErr: nil, 2440 }, 2441 { 2442 name: "OP_FROMALTSTACK long", 2443 pop: &parsedOpcode{ 2444 opcode: &opcodeArray[OP_FROMALTSTACK], 2445 data: make([]byte, 1), 2446 }, 2447 expectedErr: ErrStackInvalidOpcode, 2448 }, 2449 { 2450 name: "OP_2DROP", 2451 pop: &parsedOpcode{ 2452 opcode: &opcodeArray[OP_2DROP], 2453 data: nil, 2454 }, 2455 expectedErr: nil, 2456 }, 2457 { 2458 name: "OP_2DROP long", 2459 pop: &parsedOpcode{ 2460 opcode: &opcodeArray[OP_2DROP], 2461 data: make([]byte, 1), 2462 }, 2463 expectedErr: ErrStackInvalidOpcode, 2464 }, 2465 { 2466 name: "OP_2DUP", 2467 pop: &parsedOpcode{ 2468 opcode: &opcodeArray[OP_2DUP], 2469 data: nil, 2470 }, 2471 expectedErr: nil, 2472 }, 2473 { 2474 name: "OP_2DUP long", 2475 pop: &parsedOpcode{ 2476 opcode: &opcodeArray[OP_2DUP], 2477 data: make([]byte, 1), 2478 }, 2479 expectedErr: ErrStackInvalidOpcode, 2480 }, 2481 { 2482 name: "OP_3DUP", 2483 pop: &parsedOpcode{ 2484 opcode: &opcodeArray[OP_3DUP], 2485 data: nil, 2486 }, 2487 expectedErr: nil, 2488 }, 2489 { 2490 name: "OP_3DUP long", 2491 pop: &parsedOpcode{ 2492 opcode: &opcodeArray[OP_3DUP], 2493 data: make([]byte, 1), 2494 }, 2495 expectedErr: ErrStackInvalidOpcode, 2496 }, 2497 { 2498 name: "OP_2OVER", 2499 pop: &parsedOpcode{ 2500 opcode: &opcodeArray[OP_2OVER], 2501 data: nil, 2502 }, 2503 expectedErr: nil, 2504 }, 2505 { 2506 name: "OP_2OVER long", 2507 pop: &parsedOpcode{ 2508 opcode: &opcodeArray[OP_2OVER], 2509 data: make([]byte, 1), 2510 }, 2511 expectedErr: ErrStackInvalidOpcode, 2512 }, 2513 { 2514 name: "OP_2ROT", 2515 pop: &parsedOpcode{ 2516 opcode: &opcodeArray[OP_2ROT], 2517 data: nil, 2518 }, 2519 expectedErr: nil, 2520 }, 2521 { 2522 name: "OP_2ROT long", 2523 pop: &parsedOpcode{ 2524 opcode: &opcodeArray[OP_2ROT], 2525 data: make([]byte, 1), 2526 }, 2527 expectedErr: ErrStackInvalidOpcode, 2528 }, 2529 { 2530 name: "OP_2SWAP", 2531 pop: &parsedOpcode{ 2532 opcode: &opcodeArray[OP_2SWAP], 2533 data: nil, 2534 }, 2535 expectedErr: nil, 2536 }, 2537 { 2538 name: "OP_2SWAP long", 2539 pop: &parsedOpcode{ 2540 opcode: &opcodeArray[OP_2SWAP], 2541 data: make([]byte, 1), 2542 }, 2543 expectedErr: ErrStackInvalidOpcode, 2544 }, 2545 { 2546 name: "OP_IFDUP", 2547 pop: &parsedOpcode{ 2548 opcode: &opcodeArray[OP_IFDUP], 2549 data: nil, 2550 }, 2551 expectedErr: nil, 2552 }, 2553 { 2554 name: "OP_IFDUP long", 2555 pop: &parsedOpcode{ 2556 opcode: &opcodeArray[OP_IFDUP], 2557 data: make([]byte, 1), 2558 }, 2559 expectedErr: ErrStackInvalidOpcode, 2560 }, 2561 { 2562 name: "OP_DEPTH", 2563 pop: &parsedOpcode{ 2564 opcode: &opcodeArray[OP_DEPTH], 2565 data: nil, 2566 }, 2567 expectedErr: nil, 2568 }, 2569 { 2570 name: "OP_DEPTH long", 2571 pop: &parsedOpcode{ 2572 opcode: &opcodeArray[OP_DEPTH], 2573 data: make([]byte, 1), 2574 }, 2575 expectedErr: ErrStackInvalidOpcode, 2576 }, 2577 { 2578 name: "OP_DROP", 2579 pop: &parsedOpcode{ 2580 opcode: &opcodeArray[OP_DROP], 2581 data: nil, 2582 }, 2583 expectedErr: nil, 2584 }, 2585 { 2586 name: "OP_DROP long", 2587 pop: &parsedOpcode{ 2588 opcode: &opcodeArray[OP_DROP], 2589 data: make([]byte, 1), 2590 }, 2591 expectedErr: ErrStackInvalidOpcode, 2592 }, 2593 { 2594 name: "OP_DUP", 2595 pop: &parsedOpcode{ 2596 opcode: &opcodeArray[OP_DUP], 2597 data: nil, 2598 }, 2599 expectedErr: nil, 2600 }, 2601 { 2602 name: "OP_DUP long", 2603 pop: &parsedOpcode{ 2604 opcode: &opcodeArray[OP_DUP], 2605 data: make([]byte, 1), 2606 }, 2607 expectedErr: ErrStackInvalidOpcode, 2608 }, 2609 { 2610 name: "OP_NIP", 2611 pop: &parsedOpcode{ 2612 opcode: &opcodeArray[OP_NIP], 2613 data: nil, 2614 }, 2615 expectedErr: nil, 2616 }, 2617 { 2618 name: "OP_NIP long", 2619 pop: &parsedOpcode{ 2620 opcode: &opcodeArray[OP_NIP], 2621 data: make([]byte, 1), 2622 }, 2623 expectedErr: ErrStackInvalidOpcode, 2624 }, 2625 { 2626 name: "OP_OVER", 2627 pop: &parsedOpcode{ 2628 opcode: &opcodeArray[OP_OVER], 2629 data: nil, 2630 }, 2631 expectedErr: nil, 2632 }, 2633 { 2634 name: "OP_OVER long", 2635 pop: &parsedOpcode{ 2636 opcode: &opcodeArray[OP_OVER], 2637 data: make([]byte, 1), 2638 }, 2639 expectedErr: ErrStackInvalidOpcode, 2640 }, 2641 { 2642 name: "OP_PICK", 2643 pop: &parsedOpcode{ 2644 opcode: &opcodeArray[OP_PICK], 2645 data: nil, 2646 }, 2647 expectedErr: nil, 2648 }, 2649 { 2650 name: "OP_PICK long", 2651 pop: &parsedOpcode{ 2652 opcode: &opcodeArray[OP_PICK], 2653 data: make([]byte, 1), 2654 }, 2655 expectedErr: ErrStackInvalidOpcode, 2656 }, 2657 { 2658 name: "OP_ROLL", 2659 pop: &parsedOpcode{ 2660 opcode: &opcodeArray[OP_ROLL], 2661 data: nil, 2662 }, 2663 expectedErr: nil, 2664 }, 2665 { 2666 name: "OP_ROLL long", 2667 pop: &parsedOpcode{ 2668 opcode: &opcodeArray[OP_ROLL], 2669 data: make([]byte, 1), 2670 }, 2671 expectedErr: ErrStackInvalidOpcode, 2672 }, 2673 { 2674 name: "OP_ROT", 2675 pop: &parsedOpcode{ 2676 opcode: &opcodeArray[OP_ROT], 2677 data: nil, 2678 }, 2679 expectedErr: nil, 2680 }, 2681 { 2682 name: "OP_ROT long", 2683 pop: &parsedOpcode{ 2684 opcode: &opcodeArray[OP_ROT], 2685 data: make([]byte, 1), 2686 }, 2687 expectedErr: ErrStackInvalidOpcode, 2688 }, 2689 { 2690 name: "OP_SWAP", 2691 pop: &parsedOpcode{ 2692 opcode: &opcodeArray[OP_SWAP], 2693 data: nil, 2694 }, 2695 expectedErr: nil, 2696 }, 2697 { 2698 name: "OP_SWAP long", 2699 pop: &parsedOpcode{ 2700 opcode: &opcodeArray[OP_SWAP], 2701 data: make([]byte, 1), 2702 }, 2703 expectedErr: ErrStackInvalidOpcode, 2704 }, 2705 { 2706 name: "OP_TUCK", 2707 pop: &parsedOpcode{ 2708 opcode: &opcodeArray[OP_TUCK], 2709 data: nil, 2710 }, 2711 expectedErr: nil, 2712 }, 2713 { 2714 name: "OP_TUCK long", 2715 pop: &parsedOpcode{ 2716 opcode: &opcodeArray[OP_TUCK], 2717 data: make([]byte, 1), 2718 }, 2719 expectedErr: ErrStackInvalidOpcode, 2720 }, 2721 { 2722 name: "OP_CAT", 2723 pop: &parsedOpcode{ 2724 opcode: &opcodeArray[OP_CAT], 2725 data: nil, 2726 }, 2727 expectedErr: nil, 2728 }, 2729 { 2730 name: "OP_CAT long", 2731 pop: &parsedOpcode{ 2732 opcode: &opcodeArray[OP_CAT], 2733 data: make([]byte, 1), 2734 }, 2735 expectedErr: ErrStackInvalidOpcode, 2736 }, 2737 { 2738 name: "OP_SUBSTR", 2739 pop: &parsedOpcode{ 2740 opcode: &opcodeArray[OP_SUBSTR], 2741 data: nil, 2742 }, 2743 expectedErr: nil, 2744 }, 2745 { 2746 name: "OP_SUBSTR long", 2747 pop: &parsedOpcode{ 2748 opcode: &opcodeArray[OP_SUBSTR], 2749 data: make([]byte, 1), 2750 }, 2751 expectedErr: ErrStackInvalidOpcode, 2752 }, 2753 { 2754 name: "OP_LEFT", 2755 pop: &parsedOpcode{ 2756 opcode: &opcodeArray[OP_LEFT], 2757 data: nil, 2758 }, 2759 expectedErr: nil, 2760 }, 2761 { 2762 name: "OP_LEFT long", 2763 pop: &parsedOpcode{ 2764 opcode: &opcodeArray[OP_LEFT], 2765 data: make([]byte, 1), 2766 }, 2767 expectedErr: ErrStackInvalidOpcode, 2768 }, 2769 { 2770 name: "OP_LEFT", 2771 pop: &parsedOpcode{ 2772 opcode: &opcodeArray[OP_LEFT], 2773 data: nil, 2774 }, 2775 expectedErr: nil, 2776 }, 2777 { 2778 name: "OP_LEFT long", 2779 pop: &parsedOpcode{ 2780 opcode: &opcodeArray[OP_LEFT], 2781 data: make([]byte, 1), 2782 }, 2783 expectedErr: ErrStackInvalidOpcode, 2784 }, 2785 { 2786 name: "OP_RIGHT", 2787 pop: &parsedOpcode{ 2788 opcode: &opcodeArray[OP_RIGHT], 2789 data: nil, 2790 }, 2791 expectedErr: nil, 2792 }, 2793 { 2794 name: "OP_RIGHT long", 2795 pop: &parsedOpcode{ 2796 opcode: &opcodeArray[OP_RIGHT], 2797 data: make([]byte, 1), 2798 }, 2799 expectedErr: ErrStackInvalidOpcode, 2800 }, 2801 { 2802 name: "OP_SIZE", 2803 pop: &parsedOpcode{ 2804 opcode: &opcodeArray[OP_SIZE], 2805 data: nil, 2806 }, 2807 expectedErr: nil, 2808 }, 2809 { 2810 name: "OP_SIZE long", 2811 pop: &parsedOpcode{ 2812 opcode: &opcodeArray[OP_SIZE], 2813 data: make([]byte, 1), 2814 }, 2815 expectedErr: ErrStackInvalidOpcode, 2816 }, 2817 { 2818 name: "OP_INVERT", 2819 pop: &parsedOpcode{ 2820 opcode: &opcodeArray[OP_INVERT], 2821 data: nil, 2822 }, 2823 expectedErr: nil, 2824 }, 2825 { 2826 name: "OP_INVERT long", 2827 pop: &parsedOpcode{ 2828 opcode: &opcodeArray[OP_INVERT], 2829 data: make([]byte, 1), 2830 }, 2831 expectedErr: ErrStackInvalidOpcode, 2832 }, 2833 { 2834 name: "OP_AND", 2835 pop: &parsedOpcode{ 2836 opcode: &opcodeArray[OP_AND], 2837 data: nil, 2838 }, 2839 expectedErr: nil, 2840 }, 2841 { 2842 name: "OP_AND long", 2843 pop: &parsedOpcode{ 2844 opcode: &opcodeArray[OP_AND], 2845 data: make([]byte, 1), 2846 }, 2847 expectedErr: ErrStackInvalidOpcode, 2848 }, 2849 { 2850 name: "OP_OR", 2851 pop: &parsedOpcode{ 2852 opcode: &opcodeArray[OP_OR], 2853 data: nil, 2854 }, 2855 expectedErr: nil, 2856 }, 2857 { 2858 name: "OP_OR long", 2859 pop: &parsedOpcode{ 2860 opcode: &opcodeArray[OP_OR], 2861 data: make([]byte, 1), 2862 }, 2863 expectedErr: ErrStackInvalidOpcode, 2864 }, 2865 { 2866 name: "OP_XOR", 2867 pop: &parsedOpcode{ 2868 opcode: &opcodeArray[OP_XOR], 2869 data: nil, 2870 }, 2871 expectedErr: nil, 2872 }, 2873 { 2874 name: "OP_XOR long", 2875 pop: &parsedOpcode{ 2876 opcode: &opcodeArray[OP_XOR], 2877 data: make([]byte, 1), 2878 }, 2879 expectedErr: ErrStackInvalidOpcode, 2880 }, 2881 { 2882 name: "OP_EQUAL", 2883 pop: &parsedOpcode{ 2884 opcode: &opcodeArray[OP_EQUAL], 2885 data: nil, 2886 }, 2887 expectedErr: nil, 2888 }, 2889 { 2890 name: "OP_EQUAL long", 2891 pop: &parsedOpcode{ 2892 opcode: &opcodeArray[OP_EQUAL], 2893 data: make([]byte, 1), 2894 }, 2895 expectedErr: ErrStackInvalidOpcode, 2896 }, 2897 { 2898 name: "OP_EQUALVERIFY", 2899 pop: &parsedOpcode{ 2900 opcode: &opcodeArray[OP_EQUALVERIFY], 2901 data: nil, 2902 }, 2903 expectedErr: nil, 2904 }, 2905 { 2906 name: "OP_EQUALVERIFY long", 2907 pop: &parsedOpcode{ 2908 opcode: &opcodeArray[OP_EQUALVERIFY], 2909 data: make([]byte, 1), 2910 }, 2911 expectedErr: ErrStackInvalidOpcode, 2912 }, 2913 { 2914 name: "OP_RESERVED1", 2915 pop: &parsedOpcode{ 2916 opcode: &opcodeArray[OP_RESERVED1], 2917 data: nil, 2918 }, 2919 expectedErr: nil, 2920 }, 2921 { 2922 name: "OP_RESERVED1 long", 2923 pop: &parsedOpcode{ 2924 opcode: &opcodeArray[OP_RESERVED1], 2925 data: make([]byte, 1), 2926 }, 2927 expectedErr: ErrStackInvalidOpcode, 2928 }, 2929 { 2930 name: "OP_RESERVED2", 2931 pop: &parsedOpcode{ 2932 opcode: &opcodeArray[OP_RESERVED2], 2933 data: nil, 2934 }, 2935 expectedErr: nil, 2936 }, 2937 { 2938 name: "OP_RESERVED2 long", 2939 pop: &parsedOpcode{ 2940 opcode: &opcodeArray[OP_RESERVED2], 2941 data: make([]byte, 1), 2942 }, 2943 expectedErr: ErrStackInvalidOpcode, 2944 }, 2945 { 2946 name: "OP_1ADD", 2947 pop: &parsedOpcode{ 2948 opcode: &opcodeArray[OP_1ADD], 2949 data: nil, 2950 }, 2951 expectedErr: nil, 2952 }, 2953 { 2954 name: "OP_1ADD long", 2955 pop: &parsedOpcode{ 2956 opcode: &opcodeArray[OP_1ADD], 2957 data: make([]byte, 1), 2958 }, 2959 expectedErr: ErrStackInvalidOpcode, 2960 }, 2961 { 2962 name: "OP_1SUB", 2963 pop: &parsedOpcode{ 2964 opcode: &opcodeArray[OP_1SUB], 2965 data: nil, 2966 }, 2967 expectedErr: nil, 2968 }, 2969 { 2970 name: "OP_1SUB long", 2971 pop: &parsedOpcode{ 2972 opcode: &opcodeArray[OP_1SUB], 2973 data: make([]byte, 1), 2974 }, 2975 expectedErr: ErrStackInvalidOpcode, 2976 }, 2977 { 2978 name: "OP_2MUL", 2979 pop: &parsedOpcode{ 2980 opcode: &opcodeArray[OP_2MUL], 2981 data: nil, 2982 }, 2983 expectedErr: nil, 2984 }, 2985 { 2986 name: "OP_2MUL long", 2987 pop: &parsedOpcode{ 2988 opcode: &opcodeArray[OP_2MUL], 2989 data: make([]byte, 1), 2990 }, 2991 expectedErr: ErrStackInvalidOpcode, 2992 }, 2993 { 2994 name: "OP_2DIV", 2995 pop: &parsedOpcode{ 2996 opcode: &opcodeArray[OP_2DIV], 2997 data: nil, 2998 }, 2999 expectedErr: nil, 3000 }, 3001 { 3002 name: "OP_2DIV long", 3003 pop: &parsedOpcode{ 3004 opcode: &opcodeArray[OP_2DIV], 3005 data: make([]byte, 1), 3006 }, 3007 expectedErr: ErrStackInvalidOpcode, 3008 }, 3009 { 3010 name: "OP_NEGATE", 3011 pop: &parsedOpcode{ 3012 opcode: &opcodeArray[OP_NEGATE], 3013 data: nil, 3014 }, 3015 expectedErr: nil, 3016 }, 3017 { 3018 name: "OP_NEGATE long", 3019 pop: &parsedOpcode{ 3020 opcode: &opcodeArray[OP_NEGATE], 3021 data: make([]byte, 1), 3022 }, 3023 expectedErr: ErrStackInvalidOpcode, 3024 }, 3025 { 3026 name: "OP_ABS", 3027 pop: &parsedOpcode{ 3028 opcode: &opcodeArray[OP_ABS], 3029 data: nil, 3030 }, 3031 expectedErr: nil, 3032 }, 3033 { 3034 name: "OP_ABS long", 3035 pop: &parsedOpcode{ 3036 opcode: &opcodeArray[OP_ABS], 3037 data: make([]byte, 1), 3038 }, 3039 expectedErr: ErrStackInvalidOpcode, 3040 }, 3041 { 3042 name: "OP_NOT", 3043 pop: &parsedOpcode{ 3044 opcode: &opcodeArray[OP_NOT], 3045 data: nil, 3046 }, 3047 expectedErr: nil, 3048 }, 3049 { 3050 name: "OP_NOT long", 3051 pop: &parsedOpcode{ 3052 opcode: &opcodeArray[OP_NOT], 3053 data: make([]byte, 1), 3054 }, 3055 expectedErr: ErrStackInvalidOpcode, 3056 }, 3057 { 3058 name: "OP_0NOTEQUAL", 3059 pop: &parsedOpcode{ 3060 opcode: &opcodeArray[OP_0NOTEQUAL], 3061 data: nil, 3062 }, 3063 expectedErr: nil, 3064 }, 3065 { 3066 name: "OP_0NOTEQUAL long", 3067 pop: &parsedOpcode{ 3068 opcode: &opcodeArray[OP_0NOTEQUAL], 3069 data: make([]byte, 1), 3070 }, 3071 expectedErr: ErrStackInvalidOpcode, 3072 }, 3073 { 3074 name: "OP_ADD", 3075 pop: &parsedOpcode{ 3076 opcode: &opcodeArray[OP_ADD], 3077 data: nil, 3078 }, 3079 expectedErr: nil, 3080 }, 3081 { 3082 name: "OP_ADD long", 3083 pop: &parsedOpcode{ 3084 opcode: &opcodeArray[OP_ADD], 3085 data: make([]byte, 1), 3086 }, 3087 expectedErr: ErrStackInvalidOpcode, 3088 }, 3089 { 3090 name: "OP_SUB", 3091 pop: &parsedOpcode{ 3092 opcode: &opcodeArray[OP_SUB], 3093 data: nil, 3094 }, 3095 expectedErr: nil, 3096 }, 3097 { 3098 name: "OP_SUB long", 3099 pop: &parsedOpcode{ 3100 opcode: &opcodeArray[OP_SUB], 3101 data: make([]byte, 1), 3102 }, 3103 expectedErr: ErrStackInvalidOpcode, 3104 }, 3105 { 3106 name: "OP_MUL", 3107 pop: &parsedOpcode{ 3108 opcode: &opcodeArray[OP_MUL], 3109 data: nil, 3110 }, 3111 expectedErr: nil, 3112 }, 3113 { 3114 name: "OP_MUL long", 3115 pop: &parsedOpcode{ 3116 opcode: &opcodeArray[OP_MUL], 3117 data: make([]byte, 1), 3118 }, 3119 expectedErr: ErrStackInvalidOpcode, 3120 }, 3121 { 3122 name: "OP_DIV", 3123 pop: &parsedOpcode{ 3124 opcode: &opcodeArray[OP_DIV], 3125 data: nil, 3126 }, 3127 expectedErr: nil, 3128 }, 3129 { 3130 name: "OP_DIV long", 3131 pop: &parsedOpcode{ 3132 opcode: &opcodeArray[OP_DIV], 3133 data: make([]byte, 1), 3134 }, 3135 expectedErr: ErrStackInvalidOpcode, 3136 }, 3137 { 3138 name: "OP_MOD", 3139 pop: &parsedOpcode{ 3140 opcode: &opcodeArray[OP_MOD], 3141 data: nil, 3142 }, 3143 expectedErr: nil, 3144 }, 3145 { 3146 name: "OP_MOD long", 3147 pop: &parsedOpcode{ 3148 opcode: &opcodeArray[OP_MOD], 3149 data: make([]byte, 1), 3150 }, 3151 expectedErr: ErrStackInvalidOpcode, 3152 }, 3153 { 3154 name: "OP_LSHIFT", 3155 pop: &parsedOpcode{ 3156 opcode: &opcodeArray[OP_LSHIFT], 3157 data: nil, 3158 }, 3159 expectedErr: nil, 3160 }, 3161 { 3162 name: "OP_LSHIFT long", 3163 pop: &parsedOpcode{ 3164 opcode: &opcodeArray[OP_LSHIFT], 3165 data: make([]byte, 1), 3166 }, 3167 expectedErr: ErrStackInvalidOpcode, 3168 }, 3169 { 3170 name: "OP_RSHIFT", 3171 pop: &parsedOpcode{ 3172 opcode: &opcodeArray[OP_RSHIFT], 3173 data: nil, 3174 }, 3175 expectedErr: nil, 3176 }, 3177 { 3178 name: "OP_RSHIFT long", 3179 pop: &parsedOpcode{ 3180 opcode: &opcodeArray[OP_RSHIFT], 3181 data: make([]byte, 1), 3182 }, 3183 expectedErr: ErrStackInvalidOpcode, 3184 }, 3185 { 3186 name: "OP_BOOLAND", 3187 pop: &parsedOpcode{ 3188 opcode: &opcodeArray[OP_BOOLAND], 3189 data: nil, 3190 }, 3191 expectedErr: nil, 3192 }, 3193 { 3194 name: "OP_BOOLAND long", 3195 pop: &parsedOpcode{ 3196 opcode: &opcodeArray[OP_BOOLAND], 3197 data: make([]byte, 1), 3198 }, 3199 expectedErr: ErrStackInvalidOpcode, 3200 }, 3201 { 3202 name: "OP_BOOLOR", 3203 pop: &parsedOpcode{ 3204 opcode: &opcodeArray[OP_BOOLOR], 3205 data: nil, 3206 }, 3207 expectedErr: nil, 3208 }, 3209 { 3210 name: "OP_BOOLOR long", 3211 pop: &parsedOpcode{ 3212 opcode: &opcodeArray[OP_BOOLOR], 3213 data: make([]byte, 1), 3214 }, 3215 expectedErr: ErrStackInvalidOpcode, 3216 }, 3217 { 3218 name: "OP_NUMEQUAL", 3219 pop: &parsedOpcode{ 3220 opcode: &opcodeArray[OP_NUMEQUAL], 3221 data: nil, 3222 }, 3223 expectedErr: nil, 3224 }, 3225 { 3226 name: "OP_NUMEQUAL long", 3227 pop: &parsedOpcode{ 3228 opcode: &opcodeArray[OP_NUMEQUAL], 3229 data: make([]byte, 1), 3230 }, 3231 expectedErr: ErrStackInvalidOpcode, 3232 }, 3233 { 3234 name: "OP_NUMEQUALVERIFY", 3235 pop: &parsedOpcode{ 3236 opcode: &opcodeArray[OP_NUMEQUALVERIFY], 3237 data: nil, 3238 }, 3239 expectedErr: nil, 3240 }, 3241 { 3242 name: "OP_NUMEQUALVERIFY long", 3243 pop: &parsedOpcode{ 3244 opcode: &opcodeArray[OP_NUMEQUALVERIFY], 3245 data: make([]byte, 1), 3246 }, 3247 expectedErr: ErrStackInvalidOpcode, 3248 }, 3249 { 3250 name: "OP_NUMNOTEQUAL", 3251 pop: &parsedOpcode{ 3252 opcode: &opcodeArray[OP_NUMNOTEQUAL], 3253 data: nil, 3254 }, 3255 expectedErr: nil, 3256 }, 3257 { 3258 name: "OP_NUMNOTEQUAL long", 3259 pop: &parsedOpcode{ 3260 opcode: &opcodeArray[OP_NUMNOTEQUAL], 3261 data: make([]byte, 1), 3262 }, 3263 expectedErr: ErrStackInvalidOpcode, 3264 }, 3265 { 3266 name: "OP_LESSTHAN", 3267 pop: &parsedOpcode{ 3268 opcode: &opcodeArray[OP_LESSTHAN], 3269 data: nil, 3270 }, 3271 expectedErr: nil, 3272 }, 3273 { 3274 name: "OP_LESSTHAN long", 3275 pop: &parsedOpcode{ 3276 opcode: &opcodeArray[OP_LESSTHAN], 3277 data: make([]byte, 1), 3278 }, 3279 expectedErr: ErrStackInvalidOpcode, 3280 }, 3281 { 3282 name: "OP_GREATERTHAN", 3283 pop: &parsedOpcode{ 3284 opcode: &opcodeArray[OP_GREATERTHAN], 3285 data: nil, 3286 }, 3287 expectedErr: nil, 3288 }, 3289 { 3290 name: "OP_GREATERTHAN long", 3291 pop: &parsedOpcode{ 3292 opcode: &opcodeArray[OP_GREATERTHAN], 3293 data: make([]byte, 1), 3294 }, 3295 expectedErr: ErrStackInvalidOpcode, 3296 }, 3297 { 3298 name: "OP_LESSTHANOREQUAL", 3299 pop: &parsedOpcode{ 3300 opcode: &opcodeArray[OP_LESSTHANOREQUAL], 3301 data: nil, 3302 }, 3303 expectedErr: nil, 3304 }, 3305 { 3306 name: "OP_LESSTHANOREQUAL long", 3307 pop: &parsedOpcode{ 3308 opcode: &opcodeArray[OP_LESSTHANOREQUAL], 3309 data: make([]byte, 1), 3310 }, 3311 expectedErr: ErrStackInvalidOpcode, 3312 }, 3313 { 3314 name: "OP_GREATERTHANOREQUAL", 3315 pop: &parsedOpcode{ 3316 opcode: &opcodeArray[OP_GREATERTHANOREQUAL], 3317 data: nil, 3318 }, 3319 expectedErr: nil, 3320 }, 3321 { 3322 name: "OP_GREATERTHANOREQUAL long", 3323 pop: &parsedOpcode{ 3324 opcode: &opcodeArray[OP_GREATERTHANOREQUAL], 3325 data: make([]byte, 1), 3326 }, 3327 expectedErr: ErrStackInvalidOpcode, 3328 }, 3329 { 3330 name: "OP_MIN", 3331 pop: &parsedOpcode{ 3332 opcode: &opcodeArray[OP_MIN], 3333 data: nil, 3334 }, 3335 expectedErr: nil, 3336 }, 3337 { 3338 name: "OP_MIN long", 3339 pop: &parsedOpcode{ 3340 opcode: &opcodeArray[OP_MIN], 3341 data: make([]byte, 1), 3342 }, 3343 expectedErr: ErrStackInvalidOpcode, 3344 }, 3345 { 3346 name: "OP_MAX", 3347 pop: &parsedOpcode{ 3348 opcode: &opcodeArray[OP_MAX], 3349 data: nil, 3350 }, 3351 expectedErr: nil, 3352 }, 3353 { 3354 name: "OP_MAX long", 3355 pop: &parsedOpcode{ 3356 opcode: &opcodeArray[OP_MAX], 3357 data: make([]byte, 1), 3358 }, 3359 expectedErr: ErrStackInvalidOpcode, 3360 }, 3361 { 3362 name: "OP_WITHIN", 3363 pop: &parsedOpcode{ 3364 opcode: &opcodeArray[OP_WITHIN], 3365 data: nil, 3366 }, 3367 expectedErr: nil, 3368 }, 3369 { 3370 name: "OP_WITHIN long", 3371 pop: &parsedOpcode{ 3372 opcode: &opcodeArray[OP_WITHIN], 3373 data: make([]byte, 1), 3374 }, 3375 expectedErr: ErrStackInvalidOpcode, 3376 }, 3377 { 3378 name: "OP_RIPEMD160", 3379 pop: &parsedOpcode{ 3380 opcode: &opcodeArray[OP_RIPEMD160], 3381 data: nil, 3382 }, 3383 expectedErr: nil, 3384 }, 3385 { 3386 name: "OP_RIPEMD160 long", 3387 pop: &parsedOpcode{ 3388 opcode: &opcodeArray[OP_RIPEMD160], 3389 data: make([]byte, 1), 3390 }, 3391 expectedErr: ErrStackInvalidOpcode, 3392 }, 3393 { 3394 name: "OP_SHA1", 3395 pop: &parsedOpcode{ 3396 opcode: &opcodeArray[OP_SHA1], 3397 data: nil, 3398 }, 3399 expectedErr: nil, 3400 }, 3401 { 3402 name: "OP_SHA1 long", 3403 pop: &parsedOpcode{ 3404 opcode: &opcodeArray[OP_SHA1], 3405 data: make([]byte, 1), 3406 }, 3407 expectedErr: ErrStackInvalidOpcode, 3408 }, 3409 { 3410 name: "OP_SHA256", 3411 pop: &parsedOpcode{ 3412 opcode: &opcodeArray[OP_SHA256], 3413 data: nil, 3414 }, 3415 expectedErr: nil, 3416 }, 3417 { 3418 name: "OP_SHA256 long", 3419 pop: &parsedOpcode{ 3420 opcode: &opcodeArray[OP_SHA256], 3421 data: make([]byte, 1), 3422 }, 3423 expectedErr: ErrStackInvalidOpcode, 3424 }, 3425 { 3426 name: "OP_HASH160", 3427 pop: &parsedOpcode{ 3428 opcode: &opcodeArray[OP_HASH160], 3429 data: nil, 3430 }, 3431 expectedErr: nil, 3432 }, 3433 { 3434 name: "OP_HASH160 long", 3435 pop: &parsedOpcode{ 3436 opcode: &opcodeArray[OP_HASH160], 3437 data: make([]byte, 1), 3438 }, 3439 expectedErr: ErrStackInvalidOpcode, 3440 }, 3441 { 3442 name: "OP_HASH256", 3443 pop: &parsedOpcode{ 3444 opcode: &opcodeArray[OP_HASH256], 3445 data: nil, 3446 }, 3447 expectedErr: nil, 3448 }, 3449 { 3450 name: "OP_HASH256 long", 3451 pop: &parsedOpcode{ 3452 opcode: &opcodeArray[OP_HASH256], 3453 data: make([]byte, 1), 3454 }, 3455 expectedErr: ErrStackInvalidOpcode, 3456 }, 3457 { 3458 name: "OP_CODESAPERATOR", 3459 pop: &parsedOpcode{ 3460 opcode: &opcodeArray[OP_CODESEPARATOR], 3461 data: nil, 3462 }, 3463 expectedErr: nil, 3464 }, 3465 { 3466 name: "OP_CODESEPARATOR long", 3467 pop: &parsedOpcode{ 3468 opcode: &opcodeArray[OP_CODESEPARATOR], 3469 data: make([]byte, 1), 3470 }, 3471 expectedErr: ErrStackInvalidOpcode, 3472 }, 3473 { 3474 name: "OP_CHECKSIG", 3475 pop: &parsedOpcode{ 3476 opcode: &opcodeArray[OP_CHECKSIG], 3477 data: nil, 3478 }, 3479 expectedErr: nil, 3480 }, 3481 { 3482 name: "OP_CHECKSIG long", 3483 pop: &parsedOpcode{ 3484 opcode: &opcodeArray[OP_CHECKSIG], 3485 data: make([]byte, 1), 3486 }, 3487 expectedErr: ErrStackInvalidOpcode, 3488 }, 3489 { 3490 name: "OP_CHECKSIGVERIFY", 3491 pop: &parsedOpcode{ 3492 opcode: &opcodeArray[OP_CHECKSIGVERIFY], 3493 data: nil, 3494 }, 3495 expectedErr: nil, 3496 }, 3497 { 3498 name: "OP_CHECKSIGVERIFY long", 3499 pop: &parsedOpcode{ 3500 opcode: &opcodeArray[OP_CHECKSIGVERIFY], 3501 data: make([]byte, 1), 3502 }, 3503 expectedErr: ErrStackInvalidOpcode, 3504 }, 3505 { 3506 name: "OP_CHECKMULTISIG", 3507 pop: &parsedOpcode{ 3508 opcode: &opcodeArray[OP_CHECKMULTISIG], 3509 data: nil, 3510 }, 3511 expectedErr: nil, 3512 }, 3513 { 3514 name: "OP_CHECKMULTISIG long", 3515 pop: &parsedOpcode{ 3516 opcode: &opcodeArray[OP_CHECKMULTISIG], 3517 data: make([]byte, 1), 3518 }, 3519 expectedErr: ErrStackInvalidOpcode, 3520 }, 3521 { 3522 name: "OP_CHECKMULTISIGVERIFY", 3523 pop: &parsedOpcode{ 3524 opcode: &opcodeArray[OP_CHECKMULTISIGVERIFY], 3525 data: nil, 3526 }, 3527 expectedErr: nil, 3528 }, 3529 { 3530 name: "OP_CHECKMULTISIGVERIFY long", 3531 pop: &parsedOpcode{ 3532 opcode: &opcodeArray[OP_CHECKMULTISIGVERIFY], 3533 data: make([]byte, 1), 3534 }, 3535 expectedErr: ErrStackInvalidOpcode, 3536 }, 3537 { 3538 name: "OP_NOP1", 3539 pop: &parsedOpcode{ 3540 opcode: &opcodeArray[OP_NOP1], 3541 data: nil, 3542 }, 3543 expectedErr: nil, 3544 }, 3545 { 3546 name: "OP_NOP1 long", 3547 pop: &parsedOpcode{ 3548 opcode: &opcodeArray[OP_NOP1], 3549 data: make([]byte, 1), 3550 }, 3551 expectedErr: ErrStackInvalidOpcode, 3552 }, 3553 { 3554 name: "OP_NOP2", 3555 pop: &parsedOpcode{ 3556 opcode: &opcodeArray[OP_NOP2], 3557 data: nil, 3558 }, 3559 expectedErr: nil, 3560 }, 3561 { 3562 name: "OP_NOP2 long", 3563 pop: &parsedOpcode{ 3564 opcode: &opcodeArray[OP_NOP2], 3565 data: make([]byte, 1), 3566 }, 3567 expectedErr: ErrStackInvalidOpcode, 3568 }, 3569 { 3570 name: "OP_NOP3", 3571 pop: &parsedOpcode{ 3572 opcode: &opcodeArray[OP_NOP3], 3573 data: nil, 3574 }, 3575 expectedErr: nil, 3576 }, 3577 { 3578 name: "OP_NOP3 long", 3579 pop: &parsedOpcode{ 3580 opcode: &opcodeArray[OP_NOP3], 3581 data: make([]byte, 1), 3582 }, 3583 expectedErr: ErrStackInvalidOpcode, 3584 }, 3585 { 3586 name: "OP_NOP4", 3587 pop: &parsedOpcode{ 3588 opcode: &opcodeArray[OP_NOP4], 3589 data: nil, 3590 }, 3591 expectedErr: nil, 3592 }, 3593 { 3594 name: "OP_NOP4 long", 3595 pop: &parsedOpcode{ 3596 opcode: &opcodeArray[OP_NOP4], 3597 data: make([]byte, 1), 3598 }, 3599 expectedErr: ErrStackInvalidOpcode, 3600 }, 3601 { 3602 name: "OP_NOP5", 3603 pop: &parsedOpcode{ 3604 opcode: &opcodeArray[OP_NOP5], 3605 data: nil, 3606 }, 3607 expectedErr: nil, 3608 }, 3609 { 3610 name: "OP_NOP5 long", 3611 pop: &parsedOpcode{ 3612 opcode: &opcodeArray[OP_NOP5], 3613 data: make([]byte, 1), 3614 }, 3615 expectedErr: ErrStackInvalidOpcode, 3616 }, 3617 { 3618 name: "OP_NOP6", 3619 pop: &parsedOpcode{ 3620 opcode: &opcodeArray[OP_NOP6], 3621 data: nil, 3622 }, 3623 expectedErr: nil, 3624 }, 3625 { 3626 name: "OP_NOP6 long", 3627 pop: &parsedOpcode{ 3628 opcode: &opcodeArray[OP_NOP6], 3629 data: make([]byte, 1), 3630 }, 3631 expectedErr: ErrStackInvalidOpcode, 3632 }, 3633 { 3634 name: "OP_NOP7", 3635 pop: &parsedOpcode{ 3636 opcode: &opcodeArray[OP_NOP7], 3637 data: nil, 3638 }, 3639 expectedErr: nil, 3640 }, 3641 { 3642 name: "OP_NOP7 long", 3643 pop: &parsedOpcode{ 3644 opcode: &opcodeArray[OP_NOP7], 3645 data: make([]byte, 1), 3646 }, 3647 expectedErr: ErrStackInvalidOpcode, 3648 }, 3649 { 3650 name: "OP_NOP8", 3651 pop: &parsedOpcode{ 3652 opcode: &opcodeArray[OP_NOP8], 3653 data: nil, 3654 }, 3655 expectedErr: nil, 3656 }, 3657 { 3658 name: "OP_NOP8 long", 3659 pop: &parsedOpcode{ 3660 opcode: &opcodeArray[OP_NOP8], 3661 data: make([]byte, 1), 3662 }, 3663 expectedErr: ErrStackInvalidOpcode, 3664 }, 3665 { 3666 name: "OP_NOP9", 3667 pop: &parsedOpcode{ 3668 opcode: &opcodeArray[OP_NOP9], 3669 data: nil, 3670 }, 3671 expectedErr: nil, 3672 }, 3673 { 3674 name: "OP_NOP9 long", 3675 pop: &parsedOpcode{ 3676 opcode: &opcodeArray[OP_NOP9], 3677 data: make([]byte, 1), 3678 }, 3679 expectedErr: ErrStackInvalidOpcode, 3680 }, 3681 { 3682 name: "OP_NOP10", 3683 pop: &parsedOpcode{ 3684 opcode: &opcodeArray[OP_NOP10], 3685 data: nil, 3686 }, 3687 expectedErr: nil, 3688 }, 3689 { 3690 name: "OP_NOP10 long", 3691 pop: &parsedOpcode{ 3692 opcode: &opcodeArray[OP_NOP10], 3693 data: make([]byte, 1), 3694 }, 3695 expectedErr: ErrStackInvalidOpcode, 3696 }, 3697 { 3698 name: "OP_PUBKEYHASH", 3699 pop: &parsedOpcode{ 3700 opcode: &opcodeArray[OP_PUBKEYHASH], 3701 data: nil, 3702 }, 3703 expectedErr: nil, 3704 }, 3705 { 3706 name: "OP_PUBKEYHASH long", 3707 pop: &parsedOpcode{ 3708 opcode: &opcodeArray[OP_PUBKEYHASH], 3709 data: make([]byte, 1), 3710 }, 3711 expectedErr: ErrStackInvalidOpcode, 3712 }, 3713 { 3714 name: "OP_PUBKEY", 3715 pop: &parsedOpcode{ 3716 opcode: &opcodeArray[OP_PUBKEY], 3717 data: nil, 3718 }, 3719 expectedErr: nil, 3720 }, 3721 { 3722 name: "OP_PUBKEY long", 3723 pop: &parsedOpcode{ 3724 opcode: &opcodeArray[OP_PUBKEY], 3725 data: make([]byte, 1), 3726 }, 3727 expectedErr: ErrStackInvalidOpcode, 3728 }, 3729 { 3730 name: "OP_INVALIDOPCODE", 3731 pop: &parsedOpcode{ 3732 opcode: &opcodeArray[OP_INVALIDOPCODE], 3733 data: nil, 3734 }, 3735 expectedErr: nil, 3736 }, 3737 { 3738 name: "OP_INVALIDOPCODE long", 3739 pop: &parsedOpcode{ 3740 opcode: &opcodeArray[OP_INVALIDOPCODE], 3741 data: make([]byte, 1), 3742 }, 3743 expectedErr: ErrStackInvalidOpcode, 3744 }, 3745 } 3746 3747 for _, test := range tests { 3748 _, err := test.pop.bytes() 3749 if err != test.expectedErr { 3750 t.Errorf("Parsed Opcode test '%s' failed", test.name) 3751 t.Error(err, test.expectedErr) 3752 } 3753 } 3754 }