Skip to content

Commit ce09c16

Browse files
committed
Test commit for CI
1 parent 4fca656 commit ce09c16

File tree

2 files changed

+43
-18
lines changed

2 files changed

+43
-18
lines changed

channeld/channeld.c

+43-15
Original file line numberDiff line numberDiff line change
@@ -3992,6 +3992,7 @@ static void splice_initiator_user_finalized(struct peer *peer)
39923992
char *error;
39933993
u32 chan_output_index, splice_funding_index;
39943994
struct wally_psbt_output *new_chan_output;
3995+
struct wally_psbt *psbt;
39953996
struct inflight *new_inflight;
39963997
struct bitcoin_txid current_psbt_txid;
39973998
struct amount_sat both_amount;
@@ -4003,7 +4004,7 @@ static void splice_initiator_user_finalized(struct peer *peer)
40034004
/* We must loading the funding tx as our previous utxo */
40044005
prev_tx = bitcoin_tx_from_txid(peer, peer->channel->funding.txid);
40054006

4006-
ictx = new_interactivetx_context(tmpctx, our_role,
4007+
ictx = new_interactivetx_context(NULL, our_role,
40074008
peer->pps, peer->channel_id);
40084009

40094010
ictx->next_update_fn = next_splice_step;
@@ -4015,60 +4016,82 @@ static void splice_initiator_user_finalized(struct peer *peer)
40154016
ictx->tx_add_input_count = peer->splicing->tx_add_input_count;
40164017
ictx->tx_add_output_count = peer->splicing->tx_add_output_count;
40174018

4019+
clone_psbt(NULL, ictx->current_psbt);
4020+
40184021
ictx->shared_outpoint = tal(ictx, struct bitcoin_outpoint);
40194022
*ictx->shared_outpoint = peer->channel->funding;
40204023
ictx->funding_tx = prev_tx;
40214024

4022-
error = process_interactivetx_updates(tmpctx, ictx,
4025+
clone_psbt(NULL, ictx->current_psbt);
4026+
4027+
error = process_interactivetx_updates(ictx, ictx,
40234028
&peer->splicing->received_tx_complete,
40244029
&abort_msg);
40254030
if (error)
40264031
peer_failed_warn(peer->pps, &peer->channel_id,
40274032
"Splice interactivetx error: %s", error);
40284033

4034+
clone_psbt(NULL, ictx->current_psbt);
4035+
40294036
check_tx_abort(peer, abort_msg);
40304037

4038+
psbt = ictx->current_psbt;
4039+
4040+
clone_psbt(NULL, psbt);
4041+
40314042
/* With pause_when_complete fase, this assert should never fail */
40324043
assert(peer->splicing->received_tx_complete);
40334044
peer->splicing->sent_tx_complete = true;
40344045

4035-
psbt_sort_by_serial_id(ictx->current_psbt);
4046+
clone_psbt(NULL, psbt);
40364047

4037-
new_chan_output = find_channel_output(peer, ictx->current_psbt,
4048+
new_chan_output = find_channel_output(peer, psbt,
40384049
&chan_output_index,
40394050
&peer->splicing->remote_funding_pubkey);
4051+
4052+
clone_psbt(NULL, psbt);
40404053

4041-
splice_funding_index = find_channel_funding_input(ictx->current_psbt,
4054+
splice_funding_index = find_channel_funding_input(psbt,
40424055
&peer->channel->funding);
4056+
4057+
clone_psbt(NULL, psbt);
40434058

4044-
both_amount = check_balances(peer, our_role, ictx->current_psbt,
4059+
both_amount = check_balances(peer, our_role, psbt,
40454060
chan_output_index, splice_funding_index);
40464061
new_chan_output->amount = both_amount.satoshis; /* Raw: type conv */
4062+
4063+
clone_psbt(NULL, psbt);
40474064

4048-
psbt_elements_normalize_fees(ictx->current_psbt);
4065+
psbt_elements_normalize_fees(psbt);
4066+
4067+
clone_psbt(NULL, psbt);
40494068

40504069
status_debug("Splice adding inflight: %s",
4051-
fmt_wally_psbt(tmpctx, ictx->current_psbt));
4070+
fmt_wally_psbt(tmpctx, psbt));
40524071

4053-
psbt_txid(tmpctx, ictx->current_psbt, &current_psbt_txid, NULL);
4072+
psbt_txid(ictx, psbt, &current_psbt_txid, NULL);
4073+
4074+
clone_psbt(NULL, psbt);
40544075

4055-
outmsg = towire_channeld_add_inflight(tmpctx,
4076+
outmsg = towire_channeld_add_inflight(NULL,
40564077
&peer->splicing->remote_funding_pubkey,
40574078
&current_psbt_txid,
40584079
chan_output_index,
40594080
peer->splicing->feerate_per_kw,
40604081
amount_sat(new_chan_output->amount),
40614082
peer->splicing->opener_relative,
4062-
ictx->current_psbt,
4083+
psbt,
40634084
true,
40644085
peer->splicing->force_sign_first);
4086+
4087+
clone_psbt(NULL, psbt);
40654088

40664089
master_wait_sync_reply(tmpctx, peer, take(outmsg),
40674090
WIRE_CHANNELD_GOT_INFLIGHT);
40684091

40694092
new_inflight = inflights_new(peer);
40704093

4071-
psbt_txid(tmpctx, ictx->current_psbt, &new_inflight->outpoint.txid,
4094+
psbt_txid(new_inflight, psbt, &new_inflight->outpoint.txid,
40724095
NULL);
40734096
new_inflight->remote_funding = peer->splicing->remote_funding_pubkey;
40744097
new_inflight->outpoint.n = chan_output_index;
@@ -4084,7 +4107,7 @@ static void splice_initiator_user_finalized(struct peer *peer)
40844107
* normal in-memory copy of the psbt: peer->splicing/ictx->current_psbt.
40854108
* Since we have to support using the inflight psbt anyway, we default
40864109
* to it. */
4087-
new_inflight->psbt = clone_psbt(new_inflight, ictx->current_psbt);
4110+
new_inflight->psbt = clone_psbt(new_inflight, psbt); // wally_psbt_clone_alloc fails here
40884111

40894112
current_push_val = relative_splice_balance_fundee(peer, our_role,
40904113
new_inflight->psbt,
@@ -4121,6 +4144,8 @@ static void splice_initiator_user_finalized(struct peer *peer)
41214144
true,
41224145
!sign_first);
41234146
wire_sync_write(MASTER_FD, take(outmsg));
4147+
4148+
tal_free(ictx);
41244149
}
41254150

41264151
/* During a splice the user may call splice_update mulitple times adding
@@ -4141,7 +4166,7 @@ static void splice_initiator_user_update(struct peer *peer, const u8 *inmsg)
41414166
return;
41424167
}
41434168

4144-
ictx = new_interactivetx_context(tmpctx, TX_INITIATOR,
4169+
ictx = new_interactivetx_context(NULL, TX_INITIATOR,
41454170
peer->pps, peer->channel_id);
41464171

41474172
if (!fromwire_channeld_splice_update(ictx, inmsg, &ictx->desired_psbt))
@@ -4152,6 +4177,7 @@ static void splice_initiator_user_update(struct peer *peer, const u8 *inmsg)
41524177
" splice when not in"
41534178
" splice mode.");
41544179
wire_sync_write(MASTER_FD, take(msg));
4180+
tal_free(ictx);
41554181
return;
41564182

41574183
}
@@ -4175,10 +4201,11 @@ static void splice_initiator_user_update(struct peer *peer, const u8 *inmsg)
41754201
if (!interactivetx_has_changes(ictx, ictx->desired_psbt)) {
41764202
splice_initiator_user_finalized(peer);
41774203
tal_steal(last_inflight(peer), last_inflight(peer)->psbt);
4204+
tal_free(ictx);
41784205
return;
41794206
}
41804207

4181-
error = process_interactivetx_updates(tmpctx, ictx,
4208+
error = process_interactivetx_updates(ictx, ictx,
41824209
&peer->splicing->received_tx_complete,
41834210
&abort_msg);
41844211
if (error)
@@ -4199,6 +4226,7 @@ static void splice_initiator_user_update(struct peer *peer, const u8 *inmsg)
41994226
ictx->current_psbt,
42004227
false, false);
42014228
wire_sync_write(MASTER_FD, take(outmsg));
4229+
tal_free(ictx);
42024230
}
42034231

42044232
/* This occurs when the user has signed the final version of the PSBT. At this

common/interactivetx.c

-3
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,6 @@ char *process_interactivetx_updates(const tal_t *ctx,
391391
if (received_tx_complete)
392392
they_complete = *received_tx_complete;
393393

394-
/* Build change_set and handle PSBT variables */
395-
ictx->change_set = tal_free(ictx->change_set);
396-
397394
/* Call next_update_fn or default to 'desired_psbt' */
398395
next_psbt = ictx->next_update_fn(ictx, ictx);
399396

0 commit comments

Comments
 (0)