Skip to content

Commit 108c87e

Browse files
committed
fixup! channeld: Code to implement splicing
* Clean up the locla & remote splice amounts in commit tx creation * Add back feature options (lost in rebase) * listpeerschannels man sha update
1 parent 06e15a0 commit 108c87e

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

channeld/channeld.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ static u8 *send_commit_part(struct peer *peer,
14241424
direct_outputs, &funding_wscript,
14251425
peer->channel, &peer->remote_per_commit,
14261426
peer->next_index[REMOTE], REMOTE,
1427-
remote_splice_amnt, splice_amnt);
1427+
splice_amnt, remote_splice_amnt);
14281428
htlc_sigs =
14291429
calc_commitsigs(tmpctx, peer, txs, funding_wscript, htlc_map,
14301430
peer->next_index[REMOTE], &commit_sig);

channeld/full_channel.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ struct bitcoin_tx **channel_splice_txs(const tal_t *ctx,
321321
struct bitcoin_tx **txs;
322322
const struct htlc **committed;
323323
struct keyset keyset;
324-
struct amount_msat self_pay, other_pay;
324+
struct amount_msat side_pay, other_side_pay;
325325

326326
if (!derive_keyset(per_commitment_point,
327327
&channel->basepoints[side],
@@ -339,25 +339,30 @@ struct bitcoin_tx **channel_splice_txs(const tal_t *ctx,
339339
&channel->funding_pubkey[side],
340340
&channel->funding_pubkey[!side]);
341341

342-
self_pay = channel->view[side].owed[side];
343-
other_pay = channel->view[side].owed[!side];
342+
side_pay = channel->view[side].owed[side];
343+
other_side_pay = channel->view[side].owed[!side];
344344

345-
self_pay.millisatoshis += splice_amnt * 1000;
346-
other_pay.millisatoshis += remote_splice_amnt * 1000;
345+
if (side == LOCAL) {
346+
side_pay.millisatoshis += splice_amnt * 1000;
347+
other_side_pay.millisatoshis += remote_splice_amnt * 1000;
348+
} else if (side == REMOTE) {
349+
side_pay.millisatoshis += remote_splice_amnt * 1000;
350+
other_side_pay.millisatoshis += splice_amnt * 1000;
351+
}
347352

348353
txs = tal_arr(ctx, struct bitcoin_tx *, 1);
349354
txs[0] = commit_tx(
350-
ctx, &channel->funding,
351-
channel->funding_sats,
355+
ctx, funding,
356+
funding_sats,
352357
&channel->funding_pubkey[side],
353358
&channel->funding_pubkey[!side],
354359
channel->opener,
355360
channel->config[!side].to_self_delay,
356361
channel->lease_expiry,
357362
channel_blockheight(channel, side),
358363
&keyset, channel_feerate(channel, side),
359-
channel->config[side].dust_limit, self_pay,
360-
other_pay, committed, htlcmap, direct_outputs,
364+
channel->config[side].dust_limit, side_pay,
365+
other_side_pay, committed, htlcmap, direct_outputs,
361366
commitment_number ^ channel->commitment_number_obscurer,
362367
channel_has(channel, OPT_ANCHOR_OUTPUTS),
363368
side);

common/features.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ static const struct feature_style feature_styles[] = {
142142
{ OPT_PROVIDE_PEER_BACKUP_STORAGE,
143143
.copy_style = { [INIT_FEATURE] = FEATURE_REPRESENT,
144144
[NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT } },
145+
{ OPT_SPLICE,
146+
.copy_style = { [INIT_FEATURE] = FEATURE_REPRESENT,
147+
[NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT,
148+
[CHANNEL_FEATURE] = FEATURE_DONT_REPRESENT} },
145149
};
146150

147151
struct dependency {

doc/lightning-listpeerchannels.7.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,4 @@ Main web site: <https://github.com/ElementsProject/lightning> Lightning
195195
RFC site (BOLT \#9):
196196
<https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md>
197197

198-
[comment]: # ( SHA256STAMP:78229c9896b65ad304ec8ed928a38ac54df9d8adb00d11a26169d9f9f2957798)
198+
[comment]: # ( SHA256STAMP:f7b93b82fd618e2bd656e102b44c26ad9fdbe811b97ce8563e1768b5210688b7)

0 commit comments

Comments
 (0)