Browse Source

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
bump-pyln-proto
niftynei 4 years ago
committed by Rusty Russell
parent
commit
8d429ecd06
  1. 1
      channeld/Makefile
  2. 1
      closingd/Makefile
  3. 1
      connectd/Makefile
  4. 1
      devtools/Makefile
  5. 1
      gossipd/Makefile
  6. 1
      hsmd/Makefile
  7. 1
      lightningd/test/run-find_my_abspath.c
  8. 1
      lightningd/test/run-invoice-select-inchan.c
  9. 1
      lightningd/test/run-jsonrpc.c
  10. 1
      lightningd/test/run-log-pruning.c
  11. 1
      onchaind/Makefile
  12. 21
      wallet/reservation.c

1
channeld/Makefile

@ -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 \

1
closingd/Makefile

@ -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 \

1
connectd/Makefile

@ -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 \

1
devtools/Makefile

@ -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 \

1
gossipd/Makefile

@ -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 \

1
hsmd/Makefile

@ -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 \

1
lightningd/test/run-find_my_abspath.c

@ -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 */

1
lightningd/test/run-invoice-select-inchan.c

@ -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
lightningd/test/run-jsonrpc.c

@ -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
lightningd/test/run-log-pruning.c

@ -1,4 +1,5 @@
#include "../log.c"
#include <common/psbt_open.h>
#include <common/wireaddr.h>
/* AUTOGENERATED MOCKS START */

1
onchaind/Makefile

@ -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 \

21
wallet/reservation.c

@ -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++) {

Loading…
Cancel
Save