(flags uint32, scriptSig *Script)
| 692 | } |
| 693 | |
| 694 | func (s *Script) GetPubKeyP2SHSigOpCount(flags uint32, scriptSig *Script) int { |
| 695 | if flags&ScriptVerifyP2SH == 0 || !s.IsPayToScriptHash() { |
| 696 | return s.GetSigOpCount(flags, true) |
| 697 | } |
| 698 | |
| 699 | if scriptSig.badOpCode { |
| 700 | return 0 |
| 701 | } |
| 702 | |
| 703 | // This is a pay-to-script-hash scriptPubKey; |
| 704 | // get the last item that the scriptSig |
| 705 | // pushes onto the stack: |
| 706 | for _, e := range scriptSig.ParsedOpCodes { |
| 707 | if e.OpValue > opcodes.OP_16 { |
| 708 | return 0 |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | lastOps := scriptSig.ParsedOpCodes[len(scriptSig.ParsedOpCodes)-1] |
| 713 | tempScript := NewScriptRaw(lastOps.Data) |
| 714 | return tempScript.GetSigOpCount(flags, true) |
| 715 | } |
| 716 | |
| 717 | func EncodeOPN(n int) (int, error) { |
| 718 | if n < 0 || n > 16 { |
no test coverage detected