Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion code-ch13/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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[:]
Expand All @@ -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]))
Expand Down