What changed, and why it matters
This is a small internal cleanup in transaction parsing code. The developer removed an unnecessary 'destination' parameter from several helper macros and made them use an existing pointer variable directly. There is no change to security behavior, no bug fix, and no new feature.
No security action needed. Treat as a normal code-quality refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors the ensure_commitment, ensure_committed_value, ensure_committed_asset, and ensure_committed_nonce macros in src/transaction.c. Previously these macros took a dst argument and advanced it via switch (*dst). The caller always passed the local pointer p, so the dst parameter was redundant. The patch removes the parameter and switches to *p directly. Call sites are updated from ensure_committed_value(p) to ensure_committed_value(). The generated code and parsing logic are functionally unchanged.
Changed components
src/transaction.cInspect captured patch +13 / −13
diff --git a/src/transaction.c b/src/transaction.c
index aac98a5..0c37021 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -2243,9 +2243,9 @@ static int analyze_tx(const unsigned char *bytes, size_t bytes_len,
#define ensure_varbuff(dst) ensure_varint((dst)); \
ensure_n(*dst)
-#define ensure_commitment(dst, explicit_siz, prefix_a, prefix_b) \
+#define ensure_commitment(explicit_siz, prefix_a, prefix_b) \
ensure_n(sizeof(uint8_t)); \
- switch (*dst) { \
+ switch (*p) { \
case WALLY_TX_ASSET_CT_EMPTY_PREFIX: \
ensure_n(sizeof(uint8_t)); \
p++; \
@@ -2263,14 +2263,14 @@ static int analyze_tx(const unsigned char *bytes, size_t bytes_len,
return WALLY_EINVAL; \
}
-#define ensure_committed_value(dst) \
- ensure_commitment(dst, WALLY_TX_ASSET_CT_VALUE_UNBLIND_LEN, WALLY_TX_ASSET_CT_VALUE_PREFIX_A, WALLY_TX_ASSET_CT_VALUE_PREFIX_B)
+#define ensure_committed_value() \
+ ensure_commitment(WALLY_TX_ASSET_CT_VALUE_UNBLIND_LEN, WALLY_TX_ASSET_CT_VALUE_PREFIX_A, WALLY_TX_ASSET_CT_VALUE_PREFIX_B)
-#define ensure_committed_asset(dst) \
- ensure_commitment(dst, WALLY_TX_ASSET_CT_ASSET_LEN, WALLY_TX_ASSET_CT_ASSET_PREFIX_A, WALLY_TX_ASSET_CT_ASSET_PREFIX_B)
+#define ensure_committed_asset() \
+ ensure_commitment(WALLY_TX_ASSET_CT_ASSET_LEN, WALLY_TX_ASSET_CT_ASSET_PREFIX_A, WALLY_TX_ASSET_CT_ASSET_PREFIX_B)
-#define ensure_committed_nonce(dst) \
- ensure_commitment(dst, WALLY_TX_ASSET_CT_NONCE_LEN, WALLY_TX_ASSET_CT_NONCE_PREFIX_A, WALLY_TX_ASSET_CT_NONCE_PREFIX_B)
+#define ensure_committed_nonce() \
+ ensure_commitment(WALLY_TX_ASSET_CT_NONCE_LEN, WALLY_TX_ASSET_CT_NONCE_PREFIX_A, WALLY_TX_ASSET_CT_NONCE_PREFIX_B)
ensure_varint(&v);
*num_inputs = v;
@@ -2292,8 +2292,8 @@ static int analyze_tx(const unsigned char *bytes, size_t bytes_len,
if (expect_issuance) {
ensure_n(2 * SHA256_LEN);
p += 2 * SHA256_LEN;
- ensure_committed_value(p); /* issuance amount */
- ensure_committed_value(p); /* inflation keys */
+ ensure_committed_value(); /* issuance amount */
+ ensure_committed_value(); /* inflation keys */
}
}
@@ -2302,9 +2302,9 @@ static int analyze_tx(const unsigned char *bytes, size_t bytes_len,
for (i = 0; i < *num_outputs; ++i) {
if (is_elements) {
- ensure_committed_asset(p);
- ensure_committed_value(p);
- ensure_committed_nonce(p);
+ ensure_committed_asset();
+ ensure_committed_value();
+ ensure_committed_nonce();
} else {
ensure_n(sizeof(uint64_t));
p += sizeof(uint64_t);
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.