lightningd: remove redundant `txid` arg in depthcb_update_scid.
What changed, and why it matters
This is a small internal cleanup: a function that updates a channel's short identifier was being passed both a transaction ID and a funding outpoint, but the transaction ID is always already part of the outpoint. The change removes the redundant argument and uses the outpoint's own transaction ID instead. There is no security-relevant change.
No security action needed; this is a routine refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors depthcb_update_scid() in lightningd/channel_control.c to drop the const struct bitcoin_txid *txid parameter and derive the txid from outpoint->txid. All call sites (channel_control.c, peer_control.c, and generated test stubs) are updated accordingly. The behavior is functionally identical because every caller previously passed a txid matching outpoint->txid.
Changed components
lightningd/channel_control.clightningd/channel_control.hlightningd/peer_control.clightningd/test/run-invoice-select-inchan.cwallet/test/run-wallet.cInspect captured patch +4 / −9
diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c
index 25454041..e37230ff 100644
--- a/lightningd/channel_control.c
+++ b/lightningd/channel_control.c
@@ -803,7 +803,6 @@ static void handle_splice_sending_sigs(struct lightningd *ld,
}
bool depthcb_update_scid(struct channel *channel,
- const struct bitcoin_txid *txid,
const struct bitcoin_outpoint *outpoint)
{
struct txlocator *loc;
@@ -811,7 +810,7 @@ bool depthcb_update_scid(struct channel *channel,
struct short_channel_id scid;
/* What scid is this giving us? */
- loc = wallet_transaction_locate(tmpctx, ld->wallet, txid);
+ loc = wallet_transaction_locate(tmpctx, ld->wallet, &outpoint->txid);
if (!mk_short_channel_id(&scid,
loc->blkheight, loc->index,
outpoint->n)) {
@@ -1186,8 +1185,7 @@ static void handle_peer_splice_locked(struct channel *channel, const u8 *msg)
wallet_channel_clear_inflights(channel->peer->ld->wallet, channel);
- depthcb_update_scid(channel, &locked_txid,
- &inflight->funding->outpoint);
+ depthcb_update_scid(channel, &inflight->funding->outpoint);
/* That freed watchers in inflights: now watch funding tx */
channel_watch_funding(channel->peer->ld, channel);
diff --git a/lightningd/channel_control.h b/lightningd/channel_control.h
index 9cc417de..30774464 100644
--- a/lightningd/channel_control.h
+++ b/lightningd/channel_control.h
@@ -54,8 +54,7 @@ void lockin_has_completed(struct channel *channel, bool record_push);
void watch_splice_inflight(struct lightningd *ld,
struct channel_inflight *inflight);
-/* Update/set scid now this txid is mined. */
+/* Update/set scid now this outpoint is mined. */
bool depthcb_update_scid(struct channel *channel,
- const struct bitcoin_txid *txid,
const struct bitcoin_outpoint *outpoint);
#endif /* LIGHTNING_LIGHTNINGD_CHANNEL_CONTROL_H */
diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c
index 8e95aed0..0f858525 100644
--- a/lightningd/peer_control.c
+++ b/lightningd/peer_control.c
@@ -2381,7 +2381,7 @@ static enum watch_result funding_depth_cb(struct lightningd *ld,
return KEEP_WATCHING;
}
- if (!depthcb_update_scid(channel, txid, &channel->funding))
+ if (!depthcb_update_scid(channel, &channel->funding))
return DELETE_WATCH;
switch (channel->state) {
diff --git a/lightningd/test/run-invoice-select-inchan.c b/lightningd/test/run-invoice-select-inchan.c
index 3d64242a..b8ddaa99 100644
--- a/lightningd/test/run-invoice-select-inchan.c
+++ b/lightningd/test/run-invoice-select-inchan.c
@@ -246,7 +246,6 @@ void delete_channel(struct channel *channel STEALS UNNEEDED,
{ fprintf(stderr, "delete_channel called!\n"); abort(); }
/* Generated stub for depthcb_update_scid */
bool depthcb_update_scid(struct channel *channel UNNEEDED,
- const struct bitcoin_txid *txid UNNEEDED,
const struct bitcoin_outpoint *outpoint UNNEEDED)
{ fprintf(stderr, "depthcb_update_scid called!\n"); abort(); }
/* Generated stub for dev_disconnect_permanent */
diff --git a/wallet/test/run-wallet.c b/wallet/test/run-wallet.c
index 93364518..ce5e8b88 100644
--- a/wallet/test/run-wallet.c
+++ b/wallet/test/run-wallet.c
@@ -244,7 +244,6 @@ u8 *create_channel_announcement(const tal_t *ctx UNNEEDED,
{ fprintf(stderr, "create_channel_announcement called!\n"); abort(); }
/* Generated stub for depthcb_update_scid */
bool depthcb_update_scid(struct channel *channel UNNEEDED,
- const struct bitcoin_txid *txid UNNEEDED,
const struct bitcoin_outpoint *outpoint UNNEEDED)
{ fprintf(stderr, "depthcb_update_scid called!\n"); abort(); }
/* Generated stub for dev_disconnect_permanent */
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.