From 193728896f0cb25a8a4919a780bcaa54f03ee0ff Mon Sep 17 00:00:00 2001 From: kdmukai <934746+kdmukai@users.noreply.github.com> Date: Fri, 14 Aug 2026 17:52:32 -0500 Subject: [PATCH] Exercise the cache's read path in the equivalence test Both psbts carried a single change output, so every derivation was a first-time miss and the cached run only ever wrote to the cache. A wrong value returned on a hit would have gone unnoticed. Carrying the change output twice makes the second traversal read back what the first one cached. --- tests/test_psbt_parser.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_psbt_parser.py b/tests/test_psbt_parser.py index 1f4c44a9..71d38925 100644 --- a/tests/test_psbt_parser.py +++ b/tests/test_psbt_parser.py @@ -658,9 +658,13 @@ class TestPSBTParserOptimizations: each cosigner's account xpub. """ def build_psbt(input_base64: str, change_hex: str) -> PSBT: - # A fresh psbt for each parse: the base psbt plus its change output + # A fresh psbt for each parse: the base psbt plus its change output, twice. psbt = PSBT.parse(a2b_base64(input_base64)) psbt.outputs.append(create_output(change_hex, 10_000)) + + # Add a duplicate output to ensure that the cache yields some hits; the second + # output will traverse the same levels the first one just cached. + psbt.outputs.append(create_output(change_hex, 10_000)) return psbt def assert_cache_makes_no_difference(input_base64: str, change_hex: str):