BIP-119: Fix missing self. prefix on stack reference in pseudocode #2113

pull schjonhaug wants to merge 1 commits into bitcoin:master from schjonhaug:fix/bip119-pseudocode-typo changing 1 files +1 −1
  1. schjonhaug commented at 12:42 pm on March 4, 2026: none

    Summary

    In the execute_bip_119 pseudocode, the hash comparison references stack[-1] instead of self.stack[-1], inconsistent with all other stack references in the function:

    0# Correct:
    1if len(self.stack) < 1:
    2if len(self.stack[-1]) == 32:
    3
    4# Incorrect — missing self.:
    5if stack[-1] != self.context.tx.get_default_check_template_hash(...)
    

    In Python, stack[-1] would reference an undefined local variable, while self.stack[-1] correctly accesses the interpreter’s stack. The C++ reference implementation uses stack.back() consistently and is not affected.

  2. bip119: fix stack[-1] -> self.stack[-1] in pseudocode
    The execute_bip_119 pseudocode references `stack[-1]` on line 74
    instead of `self.stack[-1]`, inconsistent with all other stack
    references in the function. The C++ reference implementation
    correctly uses `stack.back()` throughout.
    703609f236
  3. schjonhaug marked this as ready for review on Mar 4, 2026
  4. murchandamus added the label Typo-to-be-collected on Mar 4, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-03-09 12:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me