Skip to content

Commit 3d7264c

Browse files
committed
Only expose confidential address functions when Elements support is enabled
1 parent d9439e7 commit 3d7264c

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

include/wally_address.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ WALLY_CORE_API int wally_wif_to_address(
120120
uint32_t version,
121121
char **output);
122122

123+
#ifdef BUILD_ELEMENTS
123124
/**
124125
* Extract the address from a confidential address.
125126
*
@@ -161,6 +162,7 @@ WALLY_CORE_API int wally_confidential_addr_from_addr(
161162
const unsigned char *pub_key,
162163
size_t pub_key_len,
163164
char **output);
165+
#endif /* BUILD_ELEMENTS */
164166

165167
#ifdef __cplusplus
166168
}

src/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ if RUN_PYTHON_TESTS
244244
$(AM_V_at)$(PYTHON_TEST) test/test_bip32.py
245245
$(AM_V_at)$(PYTHON_TEST) test/test_bip38.py
246246
$(AM_V_at)$(PYTHON_TEST) test/test_bip39.py
247-
$(AM_V_at)$(PYTHON_TEST) test/test_confidential_addr.py
248247
$(AM_V_at)$(PYTHON_TEST) test/test_hash.py
249248
$(AM_V_at)$(PYTHON_TEST) test/test_hex.py
250249
$(AM_V_at)$(PYTHON_TEST) test/test_hmac.py
@@ -261,6 +260,7 @@ if USE_SWIG_PYTHON
261260
$(AM_V_at)$(PYTHON_SWIGTEST) swig_python/contrib/mnemonic.py
262261
$(AM_V_at)$(PYTHON_SWIGTEST) swig_python/contrib/tx.py
263262
if BUILD_ELEMENTS
263+
$(AM_V_at)$(PYTHON_TEST) test/test_confidential_addr.py
264264
$(AM_V_at)$(PYTHON_SWIGTEST) swig_python/contrib/elements_tx.py
265265
endif
266266
endif

src/elements.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,6 @@ int wally_asset_surjectionproof(const unsigned char *output_asset, size_t output
350350
return ret;
351351
}
352352

353-
#endif /* BUILD_ELEMENTS */
354-
355353
int wally_confidential_addr_to_addr(
356354
const char *address,
357355
uint32_t prefix,
@@ -448,3 +446,5 @@ int wally_confidential_addr_from_addr(
448446
wally_clear(buf, sizeof(buf));
449447
return ret;
450448
}
449+
450+
#endif /* BUILD_ELEMENTS */

src/swig_java/jni_elements_extra.java_in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
outputs.get(0), outputs.get(1), outputs.get(2));
4141
}
4242

43+
public final static byte[] confidential_addr_to_ec_public_key(String addr, int prefix) {
44+
final byte[] buf = new byte[EC_PUBLIC_KEY_LEN];
45+
confidential_addr_to_ec_public_key(addr, prefix, buf);
46+
return buf;
47+
}
48+
4349
public final static boolean tx_elements_input_is_pegin(final Object tx_input) {
4450
return _tx_elements_input_is_pegin(tx_input) != 0;
4551
}

src/swig_java/jni_extra.java_in

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,4 @@
242242
_cleanup(0);
243243
}
244244

245-
public final static byte[] confidential_addr_to_ec_public_key(String addr, int prefix) {
246-
final byte[] buf = new byte[EC_PUBLIC_KEY_LEN];
247-
confidential_addr_to_ec_public_key(addr, prefix, buf);
248-
return buf;
249-
}
245+

src/swig_python/python_extra.py_in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,6 @@ if is_elements_build():
205205
tx_get_output_surjectionproof = _wrap_bin(tx_get_output_surjectionproof, tx_get_output_surjectionproof_len, resize=True)
206206
tx_get_output_rangeproof = _wrap_bin(tx_get_output_rangeproof, tx_get_output_rangeproof_len, resize=True)
207207

208-
confidential_addr_to_ec_public_key = _wrap_bin(confidential_addr_to_ec_public_key, EC_PUBLIC_KEY_LEN)
208+
confidential_addr_to_ec_public_key = _wrap_bin(confidential_addr_to_ec_public_key, EC_PUBLIC_KEY_LEN)
209209

210210
WALLY_SATOSHI_MAX = WALLY_BTC_MAX * WALLY_SATOSHI_PER_BTC

0 commit comments

Comments
 (0)