mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 17:47:30 +01:00
bitcoin/tx: implement wally_tx_clone (badly) for now.
When libwally exposes it, we can use theirs. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
f9300e8480
commit
d737b54625
2 changed files with 17 additions and 0 deletions
15
bitcoin/tx.c
15
bitcoin/tx.c
|
@ -17,6 +17,21 @@
|
||||||
|
|
||||||
#define SEGREGATED_WITNESS_FLAG 0x1
|
#define SEGREGATED_WITNESS_FLAG 0x1
|
||||||
|
|
||||||
|
/* FIXME: When wally exposes this, we will clash and can remove this one */
|
||||||
|
int wally_tx_clone(struct wally_tx *tx, struct wally_tx **output)
|
||||||
|
{
|
||||||
|
u8 *txlin = linearize_wtx(NULL, tx);
|
||||||
|
int flags = WALLY_TX_FLAG_USE_WITNESS;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (chainparams->is_elements)
|
||||||
|
flags |= WALLY_TX_FLAG_USE_ELEMENTS;
|
||||||
|
|
||||||
|
ret = wally_tx_from_bytes(txlin, tal_bytelen(txlin), flags, output);
|
||||||
|
tal_free(txlin);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int bitcoin_tx_add_output(struct bitcoin_tx *tx, const u8 *script,
|
int bitcoin_tx_add_output(struct bitcoin_tx *tx, const u8 *script,
|
||||||
u8 *wscript, struct amount_sat amount)
|
u8 *wscript, struct amount_sat amount)
|
||||||
{
|
{
|
||||||
|
|
|
@ -217,4 +217,6 @@ void towire_bitcoin_tx_output(u8 **pptr, const struct bitcoin_tx_output *output)
|
||||||
* Get the base64 string encoded PSBT of a bitcoin transaction.
|
* Get the base64 string encoded PSBT of a bitcoin transaction.
|
||||||
*/
|
*/
|
||||||
char *bitcoin_tx_to_psbt_base64(const tal_t *ctx, struct bitcoin_tx *tx);
|
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 */
|
#endif /* LIGHTNING_BITCOIN_TX_H */
|
||||||
|
|
Loading…
Add table
Reference in a new issue