func isPushOnly(pops []parsedOpcode) bool {
	for _, pop := range pops {
		if pop.opcode.value > OP_16 {
			return false
		}
	}
	return true
}
isPushOnly returns true if the script only pushes data, false otherwise.
package txscript
import (
	"bytes"
	"encoding/binary"
	"fmt"
	"time"
	"github.com/btcsuite/btcd/chaincfg/chainhash"
	"github.com/btcsuite/btcd/wire"
)
var Bip16Activation = time.Unix(1333238400, 0)
type SigHashType uint32
const (
	SigHashOld          SigHashType = 0x0
	SigHashAll          SigHashType = 0x1
	SigHashNone         SigHashType = 0x2
	SigHashSingle       SigHashType = 0x3
	SigHashAnyOneCanPay SigHashType = 0x80
	sigHashMask = 0x1f
)
const (
	MaxOpsPerScript       = 201  
	MaxPubKeysPerMultiSig = 20   
	MaxScriptElementSize  = 520  
)
func isSmallInt(op *opcode) bool {
	if op.value == OP_0 || (op.value >= OP_1 && op.value <= OP_16) {
		return true
	}
	return false
}
func isScriptHash(pops []parsedOpcode) bool {
	return len(pops) == 3 &&
		pops[0].opcode.value == OP_HASH160 &&
		pops[1].opcode.value == OP_DATA_20 &&
		pops[2].opcode.value == OP_EQUAL
}
func IsPayToScriptHash(script []byte) bool {
	pops, err := parseScript(script)
	if err != nil {
		return false
	}
	return isScriptHash(pops)
}
func isWitnessScriptHash(pops []parsedOpcode) bool {
	return len(pops) == 2 &&
		pops[0].opcode.value == OP_0 &&
		pops[1].opcode.value == OP_DATA_32
}
func IsPayToWitnessScriptHash(script []byte) bool {
	pops, err := parseScript(script)
	if err != nil {
		return false
	}
	return isWitnessScriptHash(pops)
}
func IsPayToWitnessPubKeyHash(script []byte) bool {
	pops, err := parseScript(script)
	if err != nil {
		return false
	}
	return isWitnessPubKeyHash(pops)
}
func isWitnessPubKeyHash(pops []parsedOpcode) bool {
	return len(pops) == 2 &&
		pops[0].opcode.value == OP_0 &&
		pops[1].opcode.value == OP_DATA_20
}
func IsWitnessProgram(script []byte) bool {
	if len(script) < 4 || len(script) > 42 {
		return false
	}
	pops, err := parseScript(script)
	if err != nil {
		return false
	}
	return isWitnessProgram(pops)
}
func isWitnessProgram(pops []parsedOpcode) bool {
	return len(pops) == 2 &&
		isSmallInt(pops[0].opcode) &&
		canonicalPush(pops[1]) &&
		(len(pops[1].data) >= 2 && len(pops[1].data) <= 40)
}
func ExtractWitnessProgramInfo(script []byte) (int, []byte, error) {
	pops, err := parseScript(script)
	if err != nil {
		return 0, nil, err
	}
	if !isWitnessProgram(pops) {
		return 0, nil, fmt.Errorf("script is not a witness program, " +
			"unable to extract version or witness program")
	}
	witnessVersion := asSmallInt(pops[0].opcode)
	witnessProgram := pops[1].data
	return witnessVersion, witnessProgram, nil
}