MCPcopy Index your code
hub / github.com/btcsuite/btcd / checkHashTypeEncoding

Method checkHashTypeEncoding

txscript/engine.go:1212–1223  ·  view source on GitHub ↗

checkHashTypeEncoding returns whether or not the passed hashtype adheres to the strict encoding requirements if enabled.

(hashType SigHashType)

Source from the content-addressed store, hash-verified

1210// checkHashTypeEncoding returns whether or not the passed hashtype adheres to
1211// the strict encoding requirements if enabled.
1212func (vm *Engine) checkHashTypeEncoding(hashType SigHashType) error {
1213 if !vm.hasFlag(ScriptVerifyStrictEncoding) {
1214 return nil
1215 }
1216
1217 sigHashType := hashType & ^SigHashAnyOneCanPay
1218 if sigHashType < SigHashAll || sigHashType > SigHashSingle {
1219 str := fmt.Sprintf("invalid hash type 0x%x", hashType)
1220 return scriptError(ErrInvalidSigHashType, str)
1221 }
1222 return nil
1223}
1224
1225// isStrictPubKeyEncoding returns whether or not the passed public key adheres
1226// to the strict encoding requirements.

Callers 2

parseBaseSigAndPubkeyFunction · 0.80
opcodeCheckMultiSigFunction · 0.80

Calls 2

hasFlagMethod · 0.95
scriptErrorFunction · 0.85

Tested by

no test coverage detected