@@ -2798,6 +2798,31 @@ static int tx_get_signature_hash(const struct wally_tx *tx,
27982798 else
27992799 ret = wally_sha256d (buff_p , n2 , bytes_out , len );
28002800
2801+ if (ret == WALLY_OK ) {
2802+ // Reconcile
2803+ unsigned char tmp [SHA256_LEN ];
2804+ struct wally_map_item value_item ;
2805+ struct wally_map values = { & value_item , 1 , 1 , NULL };
2806+ values .items [0 ].key = NULL ;
2807+ values .items [0 ].key_len = index ;
2808+ if (is_elements ) {
2809+ value_item .value = (unsigned char * )value ;
2810+ value_item .value_len = value_len ;
2811+ } else {
2812+ value_item .value = (unsigned char * )& satoshi ;
2813+ value_item .value_len = sizeof (uint64_t );
2814+ }
2815+ ret = wally_tx_get_input_signature_hash (tx , index , NULL , NULL ,
2816+ & values , script , script_len ,
2817+ 0 , WALLY_NO_CODESEPARATOR ,
2818+ NULL , 0 , NULL , 0 ,
2819+ sighash , WALLY_SIGTYPE_PRE_SW ,
2820+ NULL , tmp , len );
2821+ if (ret != WALLY_OK )
2822+ return WALLY_ERROR ;
2823+ if (memcmp (bytes_out , tmp , len ))
2824+ return WALLY_ERROR ;
2825+ }
28012826fail :
28022827 if (buff_p != buff )
28032828 clear_and_free (buff_p , n );
0 commit comments