mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
psbt-json: remove reliance on bitcoin_tx, use straight wally_psbt struct
This commit is contained in:
parent
175fcf381a
commit
85dca84327
5 changed files with 5 additions and 14 deletions
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <arpa/inet.h>
|
||||
#include <bitcoin/preimage.h>
|
||||
#include <bitcoin/privkey.h>
|
||||
#include <bitcoin/psbt.h>
|
||||
#include <bitcoin/pubkey.h>
|
||||
#include <bitcoin/short_channel_id.h>
|
||||
#include <ccan/ccan/str/hex/hex.h>
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Add table
Reference in a new issue