Skip to content

Commit 8d247fa

Browse files
ddustinrustyrussell
authored andcommitted
splice: Add more explicit error messages
To make failure casee more clear
1 parent 44e338d commit 8d247fa

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

channeld/channeld.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,6 +2015,22 @@ static struct commitsig_info *handle_peer_commit_sig(struct peer *peer,
20152015
if (commit_index) {
20162016
outpoint = peer->splice_state->inflights[commit_index - 1]->outpoint;
20172017
funding_sats = peer->splice_state->inflights[commit_index - 1]->amnt;
2018+
2019+
if (!cs_tlv || !cs_tlv->splice_info)
2020+
peer_failed_err(peer->pps, &peer->channel_id,
2021+
"Must set funding_txid for each"
2022+
" extra commitment_signed message.");
2023+
2024+
status_info("handle_peer_commit_sig for inflight outpoint %s", fmt_bitcoin_txid(tmpctx, &peer->splice_state->inflights[commit_index - 1]->outpoint.txid));
2025+
status_info("handle_peer_commit_sig cs_tlv->splice_info->funding_txid %s", fmt_bitcoin_txid(tmpctx, &cs_tlv->splice_info->funding_txid));
2026+
2027+
if (!bitcoin_txid_eq(&peer->splice_state->inflights[commit_index - 1]->outpoint.txid,
2028+
&cs_tlv->splice_info->funding_txid))
2029+
peer_failed_err(peer->pps, &peer->channel_id,
2030+
"Expected commit sig message for %s but"
2031+
" got %s",
2032+
fmt_bitcoin_txid(tmpctx, &peer->splice_state->inflights[commit_index - 1]->outpoint.txid),
2033+
fmt_bitcoin_txid(tmpctx, &cs_tlv->splice_info->funding_txid));
20182034
}
20192035
else {
20202036
outpoint = peer->channel->funding;

0 commit comments

Comments
 (0)