Skip to content

Commit

Permalink
psbt: use new non-allocating wally_psbt_get_input_best_utxo() function
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieDriver committed Aug 7, 2023
1 parent 61cf215 commit cf59627
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions main/process/sign_psbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,8 @@ int sign_psbt(const char* network, struct wally_psbt* psbt, const char** errmsg)
struct wally_psbt_input* input = &psbt->inputs[index];

// Get the utxo being spent
struct wally_tx_output* utxo = NULL;
JADE_WALLY_VERIFY(wally_psbt_get_input_best_utxo_alloc(psbt, index, &utxo));
if (!utxo) {
const struct wally_tx_output* utxo = NULL;
if (wally_psbt_get_input_best_utxo(psbt, index, &utxo) != WALLY_OK || !utxo) {
*errmsg = "Input utxo missing";
retval = CBOR_RPC_BAD_PARAMETERS;
goto cleanup;
Expand All @@ -450,7 +449,6 @@ int sign_psbt(const char* network, struct wally_psbt* psbt, const char** errmsg)
JADE_LOGW("Unsupported sighash for signing input %u", index);
*errmsg = "Unsupported sighash";
retval = CBOR_RPC_BAD_PARAMETERS;
JADE_WALLY_VERIFY(wally_tx_output_free(utxo));
goto cleanup;
}

Expand Down Expand Up @@ -499,7 +497,6 @@ int sign_psbt(const char* network, struct wally_psbt* psbt, const char** errmsg)
}
}
}
JADE_WALLY_VERIFY(wally_tx_output_free(utxo));
}

// Sanity check amounts
Expand Down

0 comments on commit cf59627

Please sign in to comment.