checkHashTypeEncoding returns whether or not the passed hashtype adheres to the strict encoding requirements if enabled.
(hashType SigHashType)
| 1210 | // checkHashTypeEncoding returns whether or not the passed hashtype adheres to |
| 1211 | // the strict encoding requirements if enabled. |
| 1212 | func (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. |
no test coverage detected