kernel: Add `btck_script_pubkey_is_p2tr` #35314

pull rustaceanrob wants to merge 2 commits into bitcoin:master from rustaceanrob:26-5-18-is-p2tr changing 4 files +34 −0
  1. rustaceanrob commented at 2:22 PM on May 18, 2026: contributor

    Currently users of the kernel must convert a script to bytes to interpret the OP codes, which can lead to errors. For instance, when scanning for silent payments, it is useful to filter transactions that do not have any P2TR outputs. Querying if a script is P2TR is non-trivial, as OP_1 = 0x51. This function removes the potential misinterpretation of script bytes.

    There are other similar methods for script, but I have omitted them as this is the only method that has a demonstrated use-case that I am aware of.

    ref: https://github.com/kernel-node/kernel-node/blob/master/crates/wallet/src/silentpayments/scanning.rs#L105

  2. kernel: Add `btck_script_pubkey_is_p2tr`
    Currently users of the kernel must convert a script to bytes to
    interpret the OP codes, which can lead to errors. For instance, when
    scanning for silent payments, it is useful to filter transactions that
    do not have any P2TR outputs. Querying if a script is P2TR is
    non-trivial, as `OP_1 = 0x51`. This function removes the potential
    mis-interpretation of script bytes.
    
    There are other similar methods for script, but I have omitted them as
    this is the only method that has a demonstrated use-case that I am aware
    of.
    
    ref: https://github.com/kernel-node/kernel-node/blob/master/crates/wallet/src/silentpayments/scanning.rs#L105
    133c41d651
  3. test(kernel): Update script tests to cover `is_p2tr`
    Unit testing counterpart to previous commit
    1b6fb0496c
  4. DrahtBot added the label Validation on May 18, 2026
  5. DrahtBot commented at 2:23 PM on May 18, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35314.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:51 UTC