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:

    # Correct:
    if len(self.stack) < 1:
    if len(self.stack[-1]) == 32:
    
    # Incorrect — missing self.:
    if 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
  5. jonatack commented at 3:48 PM on March 12, 2026: member

    LGTM, we can cherry-pick at the end of the month into the batched fixups, and if no others then merge as-is.


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-04-14 15:10 UTC

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