@@ -1262,7 +1262,7 @@ bool peer_start_channeld(struct channel *channel,
1262
1262
secp256k1_ecdsa_signature * remote_ann_node_sig , * remote_ann_bitcoin_sig ;
1263
1263
struct penalty_base * pbases ;
1264
1264
struct channel_inflight * inflight ;
1265
- struct inflight * inflights ;
1265
+ struct inflight * * inflights ;
1266
1266
struct bitcoin_txid txid ;
1267
1267
1268
1268
hsmfd = hsm_get_client_fd (ld , & channel -> peer -> id ,
@@ -1364,15 +1364,19 @@ bool peer_start_channeld(struct channel *channel,
1364
1364
return false;
1365
1365
}
1366
1366
1367
- inflights = tal_arr (tmpctx , struct inflight , 0 );
1367
+ inflights = tal_arr (tmpctx , struct inflight * , 0 );
1368
1368
list_for_each (& channel -> inflights , inflight , list ) {
1369
- struct inflight infcopy ;
1370
- infcopy .outpoint = inflight -> funding -> outpoint ;
1371
- infcopy .amnt = inflight -> funding -> total_funds ;
1372
- infcopy .splice_amnt = inflight -> funding -> splice_amnt ;
1373
- infcopy .last_tx = inflight -> last_tx ;
1374
- infcopy .last_sig = inflight -> last_sig ;
1375
- infcopy .i_am_initiator = inflight -> i_am_initiator ;
1369
+ struct inflight * infcopy = tal (inflights , struct inflight );
1370
+
1371
+ infcopy -> outpoint = inflight -> funding -> outpoint ;
1372
+ infcopy -> amnt = inflight -> funding -> total_funds ;
1373
+ infcopy -> splice_amnt = inflight -> funding -> splice_amnt ;
1374
+ infcopy -> last_tx = tal_dup (infcopy , struct bitcoin_tx , inflight -> last_tx );
1375
+ infcopy -> last_sig = inflight -> last_sig ;
1376
+ infcopy -> i_am_initiator = inflight -> i_am_initiator ;
1377
+ tal_wally_start ();
1378
+ wally_psbt_clone_alloc (inflight -> funding_psbt , 0 , & infcopy -> psbt );
1379
+ tal_wally_end_onto (infcopy , infcopy -> psbt , struct wally_psbt );
1376
1380
tal_arr_expand (& inflights , infcopy );
1377
1381
}
1378
1382
@@ -1446,7 +1450,7 @@ bool peer_start_channeld(struct channel *channel,
1446
1450
pbases ,
1447
1451
reestablish_only ,
1448
1452
channel -> channel_update ,
1449
- cast_const2 (const struct inflight * * , & inflights ));
1453
+ cast_const2 (const struct inflight * * , inflights ));
1450
1454
1451
1455
/* We don't expect a response: we are triggered by funding_depth_cb. */
1452
1456
subd_send_msg (channel -> owner , take (initmsg ));
0 commit comments