mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-25 01:54:21 +01:00
df: add needed info to any PSBT we produce
dual funding needs the max-witness-len and utxo fields set for every input. we should add them when we create a 'fundpsbt', so that every psbt that c-lightning generates is dual-funding ready
This commit is contained in:
@@ -70,6 +70,7 @@ CHANNELD_COMMON_OBJS := \
|
||||
common/per_peer_state.o \
|
||||
common/permute_tx.o \
|
||||
common/ping.o \
|
||||
common/psbt_open.o \
|
||||
common/pseudorand.o \
|
||||
common/read_peer_msg.o \
|
||||
common/setup.o \
|
||||
|
||||
@@ -46,6 +46,7 @@ CLOSINGD_COMMON_OBJS := \
|
||||
common/peer_failed.o \
|
||||
common/per_peer_state.o \
|
||||
common/permute_tx.o \
|
||||
common/psbt_open.o \
|
||||
common/pseudorand.o \
|
||||
common/read_peer_msg.o \
|
||||
common/setup.o \
|
||||
|
||||
@@ -49,6 +49,7 @@ CONNECTD_COMMON_OBJS := \
|
||||
common/node_id.o \
|
||||
common/onionreply.o \
|
||||
common/per_peer_state.o \
|
||||
common/psbt_open.o \
|
||||
common/pseudorand.o \
|
||||
common/setup.o \
|
||||
common/status.o \
|
||||
|
||||
@@ -33,6 +33,7 @@ DEVTOOLS_COMMON_OBJS := \
|
||||
common/memleak.o \
|
||||
common/node_id.o \
|
||||
common/per_peer_state.o \
|
||||
common/psbt_open.o \
|
||||
common/pseudorand.o \
|
||||
common/json.o \
|
||||
common/json_helpers.o \
|
||||
|
||||
@@ -51,6 +51,7 @@ GOSSIPD_COMMON_OBJS := \
|
||||
common/onionreply.o \
|
||||
common/per_peer_state.o \
|
||||
common/ping.o \
|
||||
common/psbt_open.o \
|
||||
common/pseudorand.o \
|
||||
common/random_select.o \
|
||||
common/setup.o \
|
||||
|
||||
@@ -31,6 +31,7 @@ HSMD_COMMON_OBJS := \
|
||||
common/msg_queue.o \
|
||||
common/node_id.o \
|
||||
common/permute_tx.o \
|
||||
common/psbt_open.o \
|
||||
common/setup.o \
|
||||
common/status.o \
|
||||
common/status_wire.o \
|
||||
|
||||
@@ -6,6 +6,7 @@ int unused_main(int argc, char *argv[]);
|
||||
#include "../lightningd.c"
|
||||
#include "../subd.c"
|
||||
#include <common/amount.h>
|
||||
#include <common/psbt_open.h>
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for activate_peers */
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "../routehint.c"
|
||||
#include <ccan/alignof/alignof.h>
|
||||
#include <common/errcode.h>
|
||||
#include <common/psbt_open.h>
|
||||
|
||||
bool deprecated_apis = false;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "../../common/json_stream.c"
|
||||
#include "../jsonrpc.c"
|
||||
#include "../json.c"
|
||||
#include <common/psbt_open.h>
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for db_begin_transaction_ */
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "../log.c"
|
||||
#include <common/psbt_open.h>
|
||||
#include <common/wireaddr.h>
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
|
||||
@@ -53,6 +53,7 @@ ONCHAIND_COMMON_OBJS := \
|
||||
common/onionreply.o \
|
||||
common/peer_billboard.o \
|
||||
common/permute_tx.o \
|
||||
common/psbt_open.o \
|
||||
common/setup.o \
|
||||
common/status.o \
|
||||
common/status_wire.o \
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <common/json_helpers.h>
|
||||
#include <common/jsonrpc_errors.h>
|
||||
#include <common/key_derive.h>
|
||||
#include <common/psbt_open.h>
|
||||
#include <lightningd/jsonrpc.h>
|
||||
#include <lightningd/lightningd.h>
|
||||
#include <wallet/wallet.h>
|
||||
@@ -141,6 +142,26 @@ static struct command_result *json_unreserveinputs(struct command *cmd,
|
||||
NULL))
|
||||
return command_param_failed();
|
||||
|
||||
/* We should also add the utxo info for these inputs!
|
||||
* (absolutely required for using this psbt in a dual-funded
|
||||
* round) */
|
||||
for (size_t i = 0; i < psbt->num_inputs; i++) {
|
||||
struct bitcoin_tx *utxo_tx;
|
||||
struct bitcoin_txid txid;
|
||||
|
||||
wally_tx_input_get_txid(&psbt->tx->inputs[i], &txid);
|
||||
utxo_tx = wallet_transaction_get(psbt, cmd->ld->wallet,
|
||||
&txid);
|
||||
if (utxo_tx)
|
||||
wally_psbt_input_set_utxo(&psbt->inputs[i],
|
||||
utxo_tx->wtx);
|
||||
else
|
||||
log_broken(cmd->ld->log,
|
||||
"No transaction found for UTXO %s",
|
||||
type_to_string(tmpctx, struct bitcoin_txid,
|
||||
&txid));
|
||||
}
|
||||
|
||||
response = json_stream_success(cmd);
|
||||
json_array_start(response, "reservations");
|
||||
for (size_t i = 0; i < psbt->tx->num_inputs; i++) {
|
||||
|
||||
Reference in New Issue
Block a user