mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
bitcoin: Add the interface to add multiple outputs to bitcoin transaction
This commit is contained in:
parent
4672795e1a
commit
6570c743c4
10
bitcoin/tx.c
10
bitcoin/tx.c
@ -30,6 +30,16 @@ int bitcoin_tx_add_output(struct bitcoin_tx *tx, const u8 *script,
|
||||
return i;
|
||||
}
|
||||
|
||||
int bitcoin_tx_add_multi_outputs(struct bitcoin_tx *tx,
|
||||
struct bitcoin_tx_output **outputs)
|
||||
{
|
||||
for (size_t j = 0; j < tal_count(outputs); j++)
|
||||
bitcoin_tx_add_output(tx, outputs[j]->script,
|
||||
outputs[j]->amount);
|
||||
|
||||
return tx->wtx->num_outputs;
|
||||
}
|
||||
|
||||
int bitcoin_tx_add_input(struct bitcoin_tx *tx, const struct bitcoin_txid *txid,
|
||||
u32 outnum, u32 sequence,
|
||||
struct amount_sat amount, u8 *script)
|
||||
|
@ -74,10 +74,14 @@ bool bitcoin_txid_to_hex(const struct bitcoin_txid *txid,
|
||||
/* Internal de-linearization functions. */
|
||||
struct bitcoin_tx *pull_bitcoin_tx(const tal_t *ctx,
|
||||
const u8 **cursor, size_t *max);
|
||||
|
||||
/* Add one output to tx. */
|
||||
int bitcoin_tx_add_output(struct bitcoin_tx *tx, const u8 *script,
|
||||
struct amount_sat amount);
|
||||
|
||||
/* Add mutiple output to tx. */
|
||||
int bitcoin_tx_add_multi_outputs(struct bitcoin_tx *tx,
|
||||
struct bitcoin_tx_output **outputs);
|
||||
|
||||
int bitcoin_tx_add_input(struct bitcoin_tx *tx, const struct bitcoin_txid *txid,
|
||||
u32 outnum, u32 sequence,
|
||||
struct amount_sat amount, u8 *script);
|
||||
|
Loading…
Reference in New Issue
Block a user