diff --git a/bitcoin/tx.c b/bitcoin/tx.c index b2f558413..ca0a15973 100644 --- a/bitcoin/tx.c +++ b/bitcoin/tx.c @@ -494,11 +494,6 @@ void bitcoin_tx_finalize(struct bitcoin_tx *tx) assert(bitcoin_tx_check(tx)); } -char *bitcoin_tx_to_psbt_base64(const tal_t *ctx, struct bitcoin_tx *tx) -{ - return psbt_to_b64(ctx, tx->psbt); -} - struct bitcoin_tx *bitcoin_tx_with_psbt(const tal_t *ctx, struct wally_psbt *psbt STEALS) { struct bitcoin_tx *tx = bitcoin_tx(ctx, chainparams, diff --git a/bitcoin/tx.h b/bitcoin/tx.h index 4c7209081..982f6ff22 100644 --- a/bitcoin/tx.h +++ b/bitcoin/tx.h @@ -220,10 +220,5 @@ void towire_bitcoin_txid(u8 **pptr, const struct bitcoin_txid *txid); void towire_bitcoin_tx(u8 **pptr, const struct bitcoin_tx *tx); void towire_bitcoin_tx_output(u8 **pptr, const struct bitcoin_tx_output *output); -/* - * Get the base64 string encoded PSBT of a bitcoin transaction. - */ -char *bitcoin_tx_to_psbt_base64(const tal_t *ctx, struct bitcoin_tx *tx); - int wally_tx_clone(struct wally_tx *tx, struct wally_tx **output); #endif /* LIGHTNING_BITCOIN_TX_H */ diff --git a/common/json_helpers.c b/common/json_helpers.c index 42841b90e..f82e4b8a0 100644 --- a/common/json_helpers.c +++ b/common/json_helpers.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -242,10 +243,10 @@ void json_add_tx(struct json_stream *result, void json_add_psbt(struct json_stream *stream, const char *fieldname, - struct bitcoin_tx *tx) + struct wally_psbt *psbt) { const char *psbt_b64; - psbt_b64 = bitcoin_tx_to_psbt_base64(tx, tx); + psbt_b64 = psbt_to_b64(NULL, psbt); json_add_string(stream, fieldname, take(psbt_b64)); } diff --git a/common/json_helpers.h b/common/json_helpers.h index 230f1a5ba..248344f20 100644 --- a/common/json_helpers.h +++ b/common/json_helpers.h @@ -141,6 +141,6 @@ void json_add_tx(struct json_stream *result, /* '"fieldname" : "cHNidP8BAJoCAAAAAljo..." or "cHNidP8BAJoCAAAAAljo..." if fieldname is NULL */ void json_add_psbt(struct json_stream *stream, const char *fieldname, - struct bitcoin_tx *tx); + struct wally_psbt *psbt); #endif /* LIGHTNING_COMMON_JSON_HELPERS_H */ diff --git a/wallet/walletrpc.c b/wallet/walletrpc.c index 068c3d44b..9d7e4dcbb 100644 --- a/wallet/walletrpc.c +++ b/wallet/walletrpc.c @@ -442,7 +442,7 @@ static struct command_result *json_txprepare(struct command *cmd, response = json_stream_success(cmd); json_add_tx(response, "unsigned_tx", utx->tx); json_add_txid(response, "txid", &utx->txid); - json_add_psbt(response, "psbt", utx->tx); + json_add_psbt(response, "psbt", utx->tx->psbt); return command_success(cmd, response); } static const struct json_command txprepare_command = {