Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@ test_mingw_static_build:
- CC=x86_64-w64-mingw32-gcc ./configure --host=x86_64-w64-mingw32 --disable-swig-python --disable-swig-java --disable-shared --enable-static
- make -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))

test_no_elements_abi:
stage: test
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
tags:
- ga
artifacts:
script:
- ./tools/cleanup.sh && ./tools/autogen.sh
- CFLAGS='-Wall -W -Wextra -Werror' ./configure --disable-swig-python --disable-swig-java --disable-clear-tests --enable-elements=no --enable-elements-abi=no
- make -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))

build_wally_release_files:
stage: release
needs: [test_mingw_static_build,test_with_valgrind,test_asan_ubsan_gcc,test_scan_build_clang,test_cmake,test_amalgamation]
Expand Down
9 changes: 8 additions & 1 deletion src/psbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -4552,10 +4552,13 @@ static int get_signing_data(const struct wally_psbt *psbt,
if (utxo) {
/* Add items to maps without allocating/copying */
append_signing_data(scripts, i, utxo->script, utxo->script_len);
#ifdef BUILD_ELEMENTS
if (assets) {
append_signing_data(assets, i, utxo->asset, utxo->asset_len);
append_signing_data(values, i, utxo->value, utxo->value_len);
} else {
} else
#endif
{
append_signing_data(values, i, (unsigned char*)&utxo->satoshi,
sizeof(utxo->satoshi));
}
Expand Down Expand Up @@ -4612,7 +4615,11 @@ int wally_psbt_get_input_signature_hash(struct wally_psbt *psbt, size_t index,
&scripts, assets_p, &values,
script, script_len,
0, WALLY_NO_CODESEPARATOR, NULL, 0,
#ifdef BUILD_ELEMENTS
psbt->genesis_blockhash, sizeof(psbt->genesis_blockhash),
#else
NULL, 0,
#endif
sighash, sighash_type,
psbt->signing_cache, bytes_out, len);

Expand Down
15 changes: 10 additions & 5 deletions src/tx_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,9 @@ static void txio_hash_tapleaf_hash(cursor_io *io,
bool is_elements)
{
const struct wally_map_item *item;
#ifndef BUILD_ELEMENTS
(void)is_elements;
#endif
item = io->cache ? wally_map_get(io->cache, tapleaf_script, tapleaf_script_len) : NULL;
if (item) {
hash_bytes(&io->ctx, item->value, item->value_len);
Expand Down Expand Up @@ -594,6 +597,9 @@ static int legacy_signature_hash(
const bool sh_none = (sighash & WALLY_SIGHASH_MASK) == WALLY_SIGHASH_NONE;
const bool sh_single = (sighash & WALLY_SIGHASH_MASK) == WALLY_SIGHASH_SINGLE;
cursor_io io;
#ifndef BUILD_ELEMENTS
(void)is_elements;
#endif

/* Note that script can be empty, so we don't check it here */
if (!tx || !values || BYTES_INVALID(script, script_len) ||
Expand Down Expand Up @@ -964,7 +970,6 @@ int wally_tx_get_input_signature_hash(
{
size_t is_elements = 0;
uint32_t sighash_type = flags & WALLY_SIGTYPE_MASK;
int ret = WALLY_EINVAL;

if (!tx || !tx->num_inputs || !tx->num_outputs || !values ||
BYTES_INVALID(script, script_len) || key_version > 1 ||
Expand All @@ -974,11 +979,11 @@ int wally_tx_get_input_signature_hash(
!flags || (flags & ~SIGTYPE_ALL) || !bytes_out || len != SHA256_LEN)
return WALLY_EINVAL;

if ((ret = wally_tx_is_elements(tx, &is_elements)) != WALLY_OK)
return ret;
#ifndef BUILD_ELEMENTS
if (is_elements)
#ifdef BUILD_ELEMENTS
if (wally_tx_is_elements(tx, &is_elements) != WALLY_OK)
return WALLY_EINVAL;
#else
(void)is_elements;
#endif

switch (sighash) {
Expand Down
Loading