wally: rename functions that clash with wally v1.0.0

Rename the offending functions from wally_foo to cln_wally_foo.

For the sake of a minimal diff, only calls which conflict with wally
v1.0.0 have been changed. However it is bad form to use the wally_
function namespace; the remaining such calls should also be renamed.

Changelog-None

Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
This commit is contained in:
Jon Griffiths 2023-11-20 08:24:42 +13:00 committed by Christian Decker
parent 3cbe35e7da
commit 1f45dd1acb
7 changed files with 15 additions and 15 deletions

View File

@ -302,8 +302,8 @@ void bitcoin_tx_output_set_amount(struct bitcoin_tx *tx, int outnum,
wally_psbt_output_set_amount(&tx->psbt->outputs[outnum], satoshis);
}
const u8 *wally_tx_output_get_script(const tal_t *ctx,
const struct wally_tx_output *output)
const u8 *cln_wally_tx_output_get_script(const tal_t *ctx,
const struct wally_tx_output *output)
{
if (output->script == NULL) {
/* This can happen for coinbase transactions and pegin
@ -321,7 +321,7 @@ const u8 *bitcoin_tx_output_get_script(const tal_t *ctx,
assert(outnum < tx->wtx->num_outputs);
output = &tx->wtx->outputs[outnum];
return wally_tx_output_get_script(ctx, output);
return cln_wally_tx_output_get_script(ctx, output);
}
u8 *bitcoin_tx_output_get_witscript(const tal_t *ctx, const struct bitcoin_tx *tx,

View File

@ -156,8 +156,8 @@ const u8 *bitcoin_tx_output_get_script(const tal_t *ctx, const struct bitcoin_tx
* comfort of being able to call `tal_bytelen` and similar on a script we just
* return a `tal_arr` clone of the original script.
*/
const u8 *wally_tx_output_get_script(const tal_t *ctx,
const struct wally_tx_output *output);
const u8 *cln_wally_tx_output_get_script(const tal_t *ctx,
const struct wally_tx_output *output);
/**
* Helper to get a witness script for an output.
*/

View File

@ -84,7 +84,7 @@ static bool is_segwit_output(const tal_t *ctx,
if (tal_bytelen(redeemscript) > 0)
maybe_witness = redeemscript;
else
maybe_witness = wally_tx_output_get_script(ctx, output);
maybe_witness = cln_wally_tx_output_get_script(ctx, output);
return is_known_segwit_scripttype(maybe_witness);
}

View File

@ -396,7 +396,7 @@ bool psbt_has_required_fields(struct wally_psbt *psbt)
/* If is P2SH, redeemscript must be present */
assert(psbt->inputs[i].index < input->utxo->num_outputs);
const u8 *outscript =
wally_tx_output_get_script(tmpctx,
cln_wally_tx_output_get_script(tmpctx,
&input->utxo->outputs[psbt->inputs[i].index]);
redeem_script = wally_map_get_integer(&psbt->inputs[i].psbt_fields, /* PSBT_IN_REDEEM_SCRIPT */ 0x04);
if (is_p2sh(outscript, NULL) && (!redeem_script || redeem_script->value_len == 0))

View File

@ -8,21 +8,21 @@
#include <sodium.h>
#include <wally_core.h>
static void *wally_tal(size_t size)
static void *cln_wally_tal(size_t size)
{
assert(wally_tal_ctx);
return tal_arr_label(wally_tal_ctx, u8, size, "wally_tal");
return tal_arr_label(wally_tal_ctx, u8, size, "cln_wally_tal");
}
static void wally_free(void *ptr)
static void cln_wally_free(void *ptr)
{
tal_free(ptr);
}
static struct wally_operations wally_tal_ops = {
.struct_size = sizeof(struct wally_operations),
.malloc_fn = wally_tal,
.free_fn = wally_free,
.malloc_fn = cln_wally_tal,
.free_fn = cln_wally_free,
};
static void *htable_tal(struct htable *ht, size_t len)

View File

@ -990,7 +990,7 @@ static char *check_balances(const tal_t *ctx,
static bool is_segwit_output(struct wally_tx_output *output)
{
const u8 *script = wally_tx_output_get_script(tmpctx, output);
const u8 *script = cln_wally_tx_output_get_script(tmpctx, output);
return is_known_segwit_scripttype(script);
}

View File

@ -2725,8 +2725,8 @@ int wallet_extract_owned_outputs(struct wallet *w, const struct wally_tx *wtx,
if (!amount_asset_is_main(&asset))
continue;
script = wally_tx_output_get_script(tmpctx,
&wtx->outputs[output]);
script = cln_wally_tx_output_get_script(tmpctx,
&wtx->outputs[output]);
if (!script)
continue;