@@ -47,11 +47,23 @@ public void test_elements_taproot_sighash() {
4747
4848 final String expected = "2c478ce6d5637e0ea8be37a53090e0955b6c501773fccf6738520cfcc5442150" ;
4949
50+ // Compute the signature hash
5051 Wally .tx_get_input_signature_hash (tx , input_idx , scripts , assets , values ,
5152 tapleaf_script , key_version , codesep_pos , annex , genesis , sighash , sighash_type ,
5253 cache , bytes_out
5354 );
54-
55+ assert_eq (expected , h (bytes_out ), "different sighash" );
56+ // Compute again to ensure the cache works as expected
57+ Wally .tx_get_input_signature_hash (tx , input_idx , scripts , assets , values ,
58+ tapleaf_script , key_version , codesep_pos , annex , genesis , sighash , sighash_type ,
59+ cache , bytes_out
60+ );
61+ assert_eq (expected , h (bytes_out ), "different sighash" );
62+ // Compute with the cache disabled (passed as null)
63+ Wally .tx_get_input_signature_hash (tx , input_idx , scripts , assets , values ,
64+ tapleaf_script , key_version , codesep_pos , annex , genesis , sighash , sighash_type ,
65+ null , bytes_out
66+ );
5567 assert_eq (expected , h (bytes_out ), "different sighash" );
5668
5769 Wally .map_free (cache );
0 commit comments