mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-09-14 04:45:08 +00:00
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.
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user