Skip to content

Commit

Permalink
BIP-119.2 Properly Trim CTV Flags w/ 21/33 byte version
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyRubin committed May 6, 2024
1 parent 44f0998 commit 144d617
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bip-0119.2.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def execute_bip_119_v2(self):
self.context.precomputed_ctv_data = self.context.tx.get_default_check_template_precomputed_data()
# If the hashes do not match, return error
if stack[-1] != ripemd(sha256(self.context.tx.get_default_check_template_hash(self.context.nIn, self.context.precomputed_ctv_data) + sha256(stack[-2]))):
if stack[-1][:-1] != ripemd(sha256(self.context.tx.get_default_check_template_hash(self.context.nIn, self.context.precomputed_ctv_data) + sha256(stack[-2]))):
return self.errors_with(errors.script_err_template_mismatch)
return self.return_as_nop()
Expand All @@ -142,7 +142,7 @@ def execute_bip_119_v2(self):
self.context.precomputed_ctv_data = self.context.tx.get_default_check_template_precomputed_data()
# If the hashes do not match, return error
if stack[-1] != sha256(self.context.tx.get_default_check_template_hash(self.context.nIn, self.context.precomputed_ctv_data) + sha256(stack[-2])):
if stack[-1][:-1] != sha256(self.context.tx.get_default_check_template_hash(self.context.nIn, self.context.precomputed_ctv_data) + sha256(stack[-2])):
return self.errors_with(errors.script_err_template_mismatch)
return self.return_as_nop()
Expand Down

0 comments on commit 144d617

Please sign in to comment.