tests: silentpayments: deduplicate setup code #1972

pull ViniciusCestarii wants to merge 3 commits into bitcoin-core:master from ViniciusCestarii:deduplicate-sp-tests changing 1 files +40 −42
  1. ViniciusCestarii commented at 6:13 PM on October 21, 2026: contributor

    Deduplicates code in silent payments as suggested by @theStack at #1943#pullrequestreview-5578778611.

    • Turns output_tweak into a reusable constant.
    • Adds function labels_cache_set_neg_output_tweak for setting the cache for negated OUTPUT_TWEAK.
    • Adds function prevouts_summary_create_bob for creating secp256k1_silentpayments_prevouts_summary with bob's first address key.
  2. tests: silentpayments: deduplicate output tweak 9c6ece8bdd
  3. tests: silentpayments: deduplicate label cache setup 67916d9bbc
  4. tests: silentpayments: deduplicate prevouts summary setup 70f321c334
  5. theStack added the label tweak/refactor on Oct 23, 2026
  6. real-or-random requested review from Copilot on Nov 3, 2026
  7. ?
    copilot_work_started real-or-random
  8. Copilot commented at 9:46 AM on November 3, 2026: none

    <!-- ccr-overview-v2 -->

    🟢 Approval recommended

    No active review issues were identified for this test-only refactor consolidating shared data and setup helpers.

    No open issues 🎉

    <details> <summary><strong>What changed in this PR</strong></summary>

    This PR reduces repeated setup in the silent payments tests by sharing test data and helper functions. All changes are confined to test code.

    Changes:

    • Extract and document the shared OUTPUT_TWEAK value.
    • Add a helper for creating a prevouts summary with Bob’s first address key.
    • Add a helper for populating the label cache with the negated output tweak.
    File Description
    src/​modules/​silentpayments/​tests_impl.h Replace repeated setup with a shared tweak value and reusable helpers.

    </details>

    <sub>Review effort: Max</sub>

  9. theStack approved
  10. theStack commented at 1:33 PM on November 12, 2026: contributor

    ACK 70f321c334dd0cfa0d8e074bc436094785bc3477

    It's a bit counter-intuitive that in the recipient tests Bob's address key serves as the sender's input pubkey, while Alice's seckey is the scan key, i.e. the roles are flipped compared to the sender tests. Not a problem of this PR though, as that was already the case before; could be cleaned up when the tests are touched the next time.

  11. real-or-random merged this on Nov 12, 2026
  12. real-or-random closed this on Nov 12, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-11-14 00:15 UTC

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