(evaluationResult: string | true)
| 305 | }; |
| 306 | |
| 307 | const failedFinalVerify = (evaluationResult: string | true): evaluationResult is string => { |
| 308 | // true indicates a successful evaluation (so no failed final verify) |
| 309 | if (evaluationResult === true) return false; |
| 310 | |
| 311 | // If any of the following errors occurred, then the final verify failed - any other messages |
| 312 | // indicate other kinds of failures |
| 313 | return toRegExp([ |
| 314 | // TODO: Ask Jason to put these back into an enum and replace with the enum value |
| 315 | 'The CashAssembly internal evaluation completed with an unexpected number of items on the stack (must be exactly 1).', // AuthenticationErrorCommon.requiresCleanStack, |
| 316 | 'The CashAssembly internal evaluation completed with a non-empty control stack.', // AuthenticationErrorCommon.nonEmptyControlStack, |
| 317 | AuthenticationErrorCommon.unsuccessfulEvaluation, |
| 318 | ]).test(evaluationResult); |
| 319 | }; |
| 320 | |
| 321 | const calculateCleanupSize = (instructions: Array<AuthenticationInstruction | undefined>): number => { |
| 322 | // OP_NIP (or OP_DROP/OP_2DROP in optimised bytecode) is used for cleanup at the end of a function, |
no test coverage detected