Skip to content

Commit fcf7e9f

Browse files
committed
channeld: factor out unneeded make_revocation_msg_from_secret
Changelog-None: internal to channeld Since we don't need a special path for early old_secrets from validate we can factor away duplicate code.
1 parent 385383d commit fcf7e9f

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

channeld/channeld.c

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,17 +1481,6 @@ static u8 *make_revocation_msg(const struct peer *peer, u64 revoke_index,
14811481
point);
14821482
}
14831483

1484-
static u8 *make_revocation_msg_from_secret(const struct peer *peer,
1485-
u64 revoke_index,
1486-
struct pubkey *point,
1487-
const struct secret *old_commit_secret,
1488-
const struct pubkey *next_point)
1489-
{
1490-
*point = *next_point;
1491-
return towire_revoke_and_ack(peer, &peer->channel_id,
1492-
old_commit_secret, next_point);
1493-
}
1494-
14951484
/* Convert changed htlcs into parts which lightningd expects. */
14961485
static void marshall_htlc_info(const tal_t *ctx,
14971486
const struct htlc **changed_htlcs,
@@ -1558,8 +1547,6 @@ static void send_revocation(struct peer *peer,
15581547
struct added_htlc *added;
15591548
const u8 *msg;
15601549
const u8 *msg_for_master;
1561-
struct secret old_secret2;
1562-
struct pubkey next_point2;
15631550

15641551
/* Marshall it now before channel_sending_revoke_and_ack changes htlcs */
15651552
/* FIXME: Make infrastructure handle state post-revoke_and_ack! */
@@ -1602,17 +1589,8 @@ static void send_revocation(struct peer *peer,
16021589

16031590
/* Now that the master has persisted the new commitment advance the HSMD
16041591
* and fetch the revocation secret for the old one. */
1605-
msg = towire_hsmd_revoke_commitment_tx(tmpctx, peer->next_index[LOCAL] - 2);
1606-
msg = hsm_req(tmpctx, take(msg));
1607-
if (!fromwire_hsmd_revoke_commitment_tx_reply(msg, &old_secret2, &next_point2))
1608-
status_failed(STATUS_FAIL_HSM_IO,
1609-
"Reading revoke_commitment_tx reply: %s",
1610-
tal_hex(tmpctx, msg));
1611-
1612-
/* Revoke previous commit, get new point. */
1613-
msg = make_revocation_msg_from_secret(peer, peer->next_index[LOCAL]-2,
1614-
&peer->next_local_per_commit,
1615-
&old_secret2, &next_point2);
1592+
msg = make_revocation_msg(peer, peer->next_index[LOCAL]-2,
1593+
&peer->next_local_per_commit);
16161594

16171595
/* Now we can finally send revoke_and_ack to peer */
16181596
peer_write(peer->pps, take(msg));

0 commit comments

Comments
 (0)