parseScriptFlags parses the provided flags string from the format used in the reference tests into ScriptFlags suitable for use in the script engine.
(flagStr string)
| 206 | // parseScriptFlags parses the provided flags string from the format used in the |
| 207 | // reference tests into ScriptFlags suitable for use in the script engine. |
| 208 | func parseScriptFlags(flagStr string) (ScriptFlags, error) { |
| 209 | var flags ScriptFlags |
| 210 | |
| 211 | sFlags := strings.Split(flagStr, ",") |
| 212 | for _, flag := range sFlags { |
| 213 | switch flag { |
| 214 | case "": |
| 215 | // Nothing. |
| 216 | case "CHECKLOCKTIMEVERIFY": |
| 217 | flags |= ScriptVerifyCheckLockTimeVerify |
| 218 | case "CHECKSEQUENCEVERIFY": |
| 219 | flags |= ScriptVerifyCheckSequenceVerify |
| 220 | case "CLEANSTACK": |
| 221 | flags |= ScriptVerifyCleanStack |
| 222 | case "DERSIG": |
| 223 | flags |= ScriptVerifyDERSignatures |
| 224 | case "DISCOURAGE_UPGRADABLE_NOPS": |
| 225 | flags |= ScriptDiscourageUpgradableNops |
| 226 | case "LOW_S": |
| 227 | flags |= ScriptVerifyLowS |
| 228 | case "MINIMALDATA": |
| 229 | flags |= ScriptVerifyMinimalData |
| 230 | case "NONE": |
| 231 | // Nothing. |
| 232 | case "NULLDUMMY": |
| 233 | flags |= ScriptStrictMultiSig |
| 234 | case "NULLFAIL": |
| 235 | flags |= ScriptVerifyNullFail |
| 236 | case "P2SH": |
| 237 | flags |= ScriptBip16 |
| 238 | case "SIGPUSHONLY": |
| 239 | flags |= ScriptVerifySigPushOnly |
| 240 | case "STRICTENC": |
| 241 | flags |= ScriptVerifyStrictEncoding |
| 242 | case "WITNESS": |
| 243 | flags |= ScriptVerifyWitness |
| 244 | case "DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM": |
| 245 | flags |= ScriptVerifyDiscourageUpgradeableWitnessProgram |
| 246 | case "MINIMALIF": |
| 247 | flags |= ScriptVerifyMinimalIf |
| 248 | case "WITNESS_PUBKEYTYPE": |
| 249 | flags |= ScriptVerifyWitnessPubKeyType |
| 250 | case "TAPROOT": |
| 251 | flags |= ScriptVerifyTaproot |
| 252 | case "CONST_SCRIPTCODE": |
| 253 | flags |= ScriptVerifyConstScriptCode |
| 254 | default: |
| 255 | return flags, fmt.Errorf("invalid flag: %s", flag) |
| 256 | } |
| 257 | } |
| 258 | return flags, nil |
| 259 | } |
| 260 | |
| 261 | // parseTxValidTestFlags parses the tx_valid flag field. Modern Bitcoin Core |
| 262 | // tx_valid vectors encode flags to exclude from the full set of script flags. |
no outgoing calls
no test coverage detected
searching dependent graphs…