diff --git a/code-ch13/script.py b/code-ch13/script.py index 3a9f0583..1238f2a0 100644 --- a/code-ch13/script.py +++ b/code-ch13/script.py @@ -153,7 +153,7 @@ def serialize(self): # encode_varint the total length of the result and prepend return encode_varint(total) + result - def evaluate(self, z, witness): + def evaluate(self, z, witness, version=None, locktime=None, sequence=None): # create a copy as we may need to add to this list if we have a # RedeemScript cmds = self.cmds[:] @@ -180,6 +180,16 @@ def evaluate(self, z, witness): if not operation(stack, z): LOGGER.info('bad op: {}'.format(OP_CODE_NAMES[cmd])) return False + elif cmd == 177: + # 177 is OP_CHECKLOCKTIMEVERIFY. Operation requires locktime and sequence. + if not operation(stack, locktime, sequence): + LOGGER.info(f"bad op: {OP_CODE_NAMES[cmd]}") + return False + elif cmd == 178: + # 178 is OP_CHECKSEQUENCEVERIFY. Operation requires sequence and version. + if not operation(stack, version, sequence): + LOGGER.info(f"bad op: {OP_CODE_NAMES[cmd]}") + return False else: if not operation(stack): LOGGER.info('bad op: {}'.format(OP_CODE_NAMES[cmd]))