@@ -482,8 +482,8 @@ static int tx_elements_input_issuance_init(
482482#endif
483483
484484 if (!input ||
485- BYTES_INVALID_N (nonce , nonce_len , WALLY_TX_ASSET_TAG_LEN ) ||
486- BYTES_INVALID_N (entropy , entropy_len , WALLY_TX_ASSET_TAG_LEN ) ||
485+ BYTES_INVALID_N (nonce , nonce_len , SHA256_LEN ) ||
486+ BYTES_INVALID_N (entropy , entropy_len , SHA256_LEN ) ||
487487 BYTES_INVALID (issuance_amount , issuance_amount_len ) ||
488488 BYTES_INVALID (inflation_keys , inflation_keys_len ) ||
489489 BYTES_INVALID (issuance_amount_rangeproof , issuance_amount_rangeproof_len ) ||
@@ -1311,8 +1311,8 @@ static int tx_add_elements_raw_input_at(
13111311 return WALLY_EINVAL ; /* TODO: Allow creation of p2pkh/p2sh using flags */
13121312
13131313 if (!txhash || txhash_len != WALLY_TXHASH_LEN ||
1314- BYTES_INVALID_N (nonce , nonce_len , WALLY_TX_ASSET_TAG_LEN ) ||
1315- BYTES_INVALID_N (entropy , entropy_len , WALLY_TX_ASSET_TAG_LEN ) ||
1314+ BYTES_INVALID_N (nonce , nonce_len , SHA256_LEN ) ||
1315+ BYTES_INVALID_N (entropy , entropy_len , SHA256_LEN ) ||
13161316 BYTES_INVALID (issuance_amount , issuance_amount_len ) ||
13171317 BYTES_INVALID (inflation_keys , inflation_keys_len ) ||
13181318 BYTES_INVALID (issuance_amount_rangeproof , issuance_amount_rangeproof_len ) ||
@@ -1336,9 +1336,9 @@ static int tx_add_elements_raw_input_at(
13361336 memcpy (input .txhash , txhash , WALLY_TXHASH_LEN );
13371337#ifdef BUILD_ELEMENTS
13381338 if (nonce )
1339- memcpy (input .blinding_nonce , nonce , WALLY_TX_ASSET_TAG_LEN );
1339+ memcpy (input .blinding_nonce , nonce , SHA256_LEN );
13401340 if (entropy )
1341- memcpy (input .entropy , entropy , WALLY_TX_ASSET_TAG_LEN );
1341+ memcpy (input .entropy , entropy , SHA256_LEN );
13421342#endif /* BUILD_ELEMENTS */
13431343 ret = wally_tx_add_input_at (tx , index , & input );
13441344 wally_clear (& input , sizeof (input ));
@@ -2214,10 +2214,10 @@ static inline int tx_to_bip143_bytes(const struct wally_tx *tx,
22142214 unsigned char * tmp_p = buff_p ;
22152215 for (i = 0 ; i < tx -> num_inputs ; ++ i ) {
22162216 if (tx -> inputs [i ].features & WALLY_TX_IS_ISSUANCE ) {
2217- memcpy (tmp_p , tx -> inputs [i ].blinding_nonce , WALLY_TX_ASSET_TAG_LEN );
2218- tmp_p += WALLY_TX_ASSET_TAG_LEN ;
2219- memcpy (tmp_p , tx -> inputs [i ].entropy , WALLY_TX_ASSET_TAG_LEN );
2220- tmp_p += WALLY_TX_ASSET_TAG_LEN ;
2217+ memcpy (tmp_p , tx -> inputs [i ].blinding_nonce , SHA256_LEN );
2218+ tmp_p += SHA256_LEN ;
2219+ memcpy (tmp_p , tx -> inputs [i ].entropy , SHA256_LEN );
2220+ tmp_p += SHA256_LEN ;
22212221 tmp_p += confidential_value_to_bytes (tx -> inputs [i ].issuance_amount ,
22222222 tx -> inputs [i ].issuance_amount_len , tmp_p );
22232223 tmp_p += confidential_value_to_bytes (tx -> inputs [i ].inflation_keys ,
@@ -2249,10 +2249,10 @@ static inline int tx_to_bip143_bytes(const struct wally_tx *tx,
22492249
22502250#ifdef BUILD_ELEMENTS
22512251 if (is_elements && (tx -> inputs [opts -> index ].features & WALLY_TX_IS_ISSUANCE )) {
2252- memcpy (p , tx -> inputs [opts -> index ].blinding_nonce , WALLY_TX_ASSET_TAG_LEN );
2253- p += WALLY_TX_ASSET_TAG_LEN ;
2254- memcpy (p , tx -> inputs [opts -> index ].entropy , WALLY_TX_ASSET_TAG_LEN );
2255- p += WALLY_TX_ASSET_TAG_LEN ;
2252+ memcpy (p , tx -> inputs [opts -> index ].blinding_nonce , SHA256_LEN );
2253+ p += SHA256_LEN ;
2254+ memcpy (p , tx -> inputs [opts -> index ].entropy , SHA256_LEN );
2255+ p += SHA256_LEN ;
22562256 p += confidential_value_to_bytes (tx -> inputs [opts -> index ].issuance_amount ,
22572257 tx -> inputs [opts -> index ].issuance_amount_len , p );
22582258 p += confidential_value_to_bytes (tx -> inputs [opts -> index ].inflation_keys ,
@@ -2660,10 +2660,10 @@ static int tx_to_bytes(const struct wally_tx *tx,
26602660 if (!is_elements )
26612661 return WALLY_EINVAL ;
26622662#ifdef BUILD_ELEMENTS
2663- memcpy (p , input -> blinding_nonce , WALLY_TX_ASSET_TAG_LEN );
2664- p += WALLY_TX_ASSET_TAG_LEN ;
2665- memcpy (p , input -> entropy , WALLY_TX_ASSET_TAG_LEN );
2666- p += WALLY_TX_ASSET_TAG_LEN ;
2663+ memcpy (p , input -> blinding_nonce , SHA256_LEN );
2664+ p += SHA256_LEN ;
2665+ memcpy (p , input -> entropy , SHA256_LEN );
2666+ p += SHA256_LEN ;
26672667 p += confidential_value_to_bytes (input -> issuance_amount , input -> issuance_amount_len , p );
26682668 p += confidential_value_to_bytes (input -> inflation_keys , input -> inflation_keys_len , p );
26692669#endif
@@ -2926,8 +2926,8 @@ static int analyze_tx(const unsigned char *bytes, size_t bytes_len,
29262926 ensure_n (sizeof (uint32_t ));
29272927 p += sizeof (uint32_t );
29282928 if (expect_issuance ) {
2929- ensure_n (2 * WALLY_TX_ASSET_TAG_LEN );
2930- p += 2 * WALLY_TX_ASSET_TAG_LEN ;
2929+ ensure_n (2 * SHA256_LEN );
2930+ p += 2 * SHA256_LEN ;
29312931 ensure_committed_value (p ); /* issuance amount */
29322932 ensure_committed_value (p ); /* inflation keys */
29332933 }
@@ -3069,18 +3069,18 @@ static int tx_from_bytes(const unsigned char *bytes, size_t bytes_len,
30693069 p += uint32_from_le_bytes (p , & sequence );
30703070 if (is_elements && !!(index & WALLY_TX_ISSUANCE_FLAG ) && !is_coinbase_bytes (txhash , WALLY_TXHASH_LEN , index )) {
30713071 nonce = p ;
3072- p += WALLY_TX_ASSET_TAG_LEN ;
3072+ p += SHA256_LEN ;
30733073 entropy = p ;
3074- p += WALLY_TX_ASSET_TAG_LEN ;
3074+ p += SHA256_LEN ;
30753075 issuance_amount = p ;
30763076 p += confidential_value_varint_from_bytes (p , & issuance_amount_len );
30773077 inflation_keys = p ;
30783078 p += confidential_value_varint_from_bytes (p , & inflation_keys_len );
30793079 }
30803080 ret = tx_elements_input_init (txhash , WALLY_TXHASH_LEN , index , sequence ,
30813081 script_len ? script : NULL , script_len , NULL ,
3082- nonce , nonce ? WALLY_TX_ASSET_TAG_LEN : 0 ,
3083- entropy , entropy ? WALLY_TX_ASSET_TAG_LEN : 0 ,
3082+ nonce , nonce ? SHA256_LEN : 0 ,
3083+ entropy , entropy ? SHA256_LEN : 0 ,
30843084 issuance_amount_len ? issuance_amount : NULL , issuance_amount_len ,
30853085 inflation_keys_len ? inflation_keys : NULL , inflation_keys_len ,
30863086 NULL , 0 , NULL , 0 , NULL , & (* output )-> inputs [i ], is_elements );
0 commit comments