Files
palladum-lightning/channeld/channeld_wire.csv
Peter Neuroth ef52de88aa channeld: Add extra_tlvs to incomming wire msg
This appends the extra_tlvs to the internal channeld_offer_htlc wire
msg. We also recombine the extra_tlvs with the blinded path key for
forwarding htlcs.

Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
2025-08-14 18:57:05 +09:30

15 KiB

1#include <bitcoin/psbt.h>
2#include <bitcoin/tx.h>
3#include <channeld/inflight.h>
4#include <common/bip32.h>
5#include <common/blockheight_states.h>
6#include <common/cryptomsg.h>
7#include <common/channel_config.h>
8#include <common/channel_id.h>
9#include <common/channel_type.h>
10#include <common/derive_basepoints.h>
11#include <common/features.h>
12#include <common/fee_states.h>
13#include <wire/peer_wire.h>
14# Begin! (passes gossipd-client fd)
15msgtypechanneld_init1000
16msgdatachanneld_initchainparamschainparams
17msgdatachanneld_initour_featuresfeature_set
18msgdatachanneld_initnum_hsm_capabilitiesu16
19msgdatachanneld_inithsm_capabilitiesu32num_hsm_capabilities
20msgdatachanneld_initchannel_idchannel_id
21msgdatachanneld_initfundingbitcoin_outpoint
22msgdatachanneld_initfunding_satoshiamount_sat
23msgdatachanneld_initminimum_depthu32
24msgdatachanneld_initour_blockheightu32
25msgdatachanneld_initblockheight_statesheight_states
26msgdatachanneld_initlease_expiryu32
27msgdatachanneld_initour_configchannel_config
28msgdatachanneld_inittheir_configchannel_config
29msgdatachanneld_initfee_statesfee_states
30msgdatachanneld_initfeerate_minu32
31msgdatachanneld_initfeerate_maxu32
32msgdatachanneld_initfeerate_penaltyu32
33msgdatachanneld_initfirst_commit_sigbitcoin_signature
34msgdatachanneld_initremote_fundingkeypubkey
35msgdatachanneld_initremote_basepointsbasepoints
36msgdatachanneld_initremote_per_commitpubkey
37msgdatachanneld_initold_remote_per_commitpubkey
38msgdatachanneld_initopenerenum side
39msgdatachanneld_initlocal_msatoshiamount_msat
40msgdatachanneld_initour_basepointsbasepoints
41msgdatachanneld_initour_funding_pubkeypubkey
42msgdatachanneld_initcommit_msecu32
43msgdatachanneld_initlast_was_revokebool
44msgdatachanneld_initnum_last_sent_commitu16
45msgdatachanneld_initlast_sent_commitchanged_htlcnum_last_sent_commit
46msgdatachanneld_initnext_index_localu64
47msgdatachanneld_initnext_index_remoteu64
48msgdatachanneld_initrevocations_receivedu64
49msgdatachanneld_initnext_htlc_idu64
50msgdatachanneld_initnum_existing_htlcsu16
51msgdatachanneld_inithtlcsexisting_htlcnum_existing_htlcs
52msgdatachanneld_initlocal_channel_readybool
53msgdatachanneld_initremote_channel_readybool
54msgdatachanneld_initfunding_short_idshort_channel_id
55msgdatachanneld_initreestablishbool
56msgdatachanneld_initsend_shutdownbool
57msgdatachanneld_initremote_shutdown_receivedbool
58msgdatachanneld_initfinal_indexu32
59msgdatachanneld_initfinal_ext_keyext_key
60msgdatachanneld_initfinal_scriptpubkey_lenu16
61msgdatachanneld_initfinal_scriptpubkeyu8final_scriptpubkey_len
62msgdatachanneld_initflagsu8
63msgdatachanneld_initinit_peer_pkt_lenu16
64msgdatachanneld_initinit_peer_pktu8init_peer_pkt_len
65msgdatachanneld_initlast_remote_secretsecret
66msgdatachanneld_initflenu16
67msgdatachanneld_inittheir_featuresu8flen
68msgdatachanneld_initupfront_shutdown_script_lenu16
69msgdatachanneld_initupfront_shutdown_scriptu8upfront_shutdown_script_len
70msgdatachanneld_initdesired_typechannel_type
71msgdatachanneld_initdev_disable_commit?u32
72msgdatachanneld_initnum_penalty_basesu32
73msgdatachanneld_initpbasespenalty_basenum_penalty_bases
74msgdatachanneld_initnum_inflightsu16
75msgdatachanneld_initinflightsinflightnum_inflights
76msgdatachanneld_initscid_aliasshort_channel_id
77# channeld->lightningd: successfully negotated reestablishment.
78msgtypechanneld_reestablished1101
79# master->channeld funding hit new depth(funding locked if >= lock depth)
80# short_channel_id != NULL once we have 3+ confirmations
81msgtypechanneld_funding_depth1002
82msgdatachanneld_funding_depthshort_channel_id?short_channel_id
83msgdatachanneld_funding_depthdepthu32
84msgdatachanneld_funding_depthsplicingbool
85msgdatachanneld_funding_depthtxidbitcoin_txid
86# Tell channel to offer this htlc
87msgtypechanneld_offer_htlc1004
88msgdatachanneld_offer_htlcamount_msatamount_msat
89msgdatachanneld_offer_htlccltv_expiryu32
90msgdatachanneld_offer_htlcpayment_hashsha256
91msgdatachanneld_offer_htlconion_routing_packetu81366
92msgdatachanneld_offer_htlcpath_key?pubkey
93msgdatachanneld_offer_htlcextra_tlvs_lenu16
94msgdatachanneld_offer_htlcextra_tlvsu8extra_tlvs_len
95# Reply; synchronous since IDs have to increment.
96msgtypechanneld_offer_htlc_reply1104
97msgdatachanneld_offer_htlc_replyidu64
98# Empty failure message means success.
99msgdatachanneld_offer_htlc_replylenu16
100msgdatachanneld_offer_htlc_replyfailuremsgu8len
101msgdatachanneld_offer_htlc_replyfailurestrwirestring
102# Main daemon found out the preimage for an HTLC
103#include <bitcoin/preimage.h>
104msgtypechanneld_fulfill_htlc1005
105msgdatachanneld_fulfill_htlcfulfilled_htlcfulfilled_htlc
106# Main daemon says HTLC failed
107msgtypechanneld_fail_htlc1006
108msgdatachanneld_fail_htlcfailed_htlcfailed_htlc
109# When we receive channel_ready.
110msgtypechanneld_got_channel_ready1019
111msgdatachanneld_got_channel_readynext_per_commit_pointpubkey
112msgdatachanneld_got_channel_readyalias?short_channel_id
113# When we receive funding_locked.
114msgtypechanneld_got_splice_locked1119
115msgdatachanneld_got_splice_lockedfunding_satsamount_sat
116msgdatachanneld_got_splice_lockedsplice_amnts64
117msgdatachanneld_got_splice_lockedlocked_txidbitcoin_txid
118#include <common/penalty_base.h>
119subtypelocal_anchor_info
120subtypedatalocal_anchor_infocommitment_weightu32
121subtypedatalocal_anchor_infocommitment_feeamount_sat
122subtypedatalocal_anchor_infoanchor_pointbitcoin_outpoint
123# lightningd needs to track our anchor outputs on remote txs.
124# This includes splicesso there could be more than one!
125msgtypechanneld_local_anchor_info1003
126msgdatachanneld_local_anchor_inforemote_commitnumu64
127msgdatachanneld_local_anchor_infonum_anchorsu16
128msgdatachanneld_local_anchor_infoanchorslocal_anchor_infonum_anchors
129# When we send a commitment_signed messagetell master.
130msgtypechanneld_sending_commitsig1020
131msgdatachanneld_sending_commitsigcommitnumu64
132msgdatachanneld_sending_commitsigpbase?penalty_base
133msgdatachanneld_sending_commitsigfee_statesfee_states
134msgdatachanneld_sending_commitsigblockheight_statesheight_states
135# SENT_ADD_COMMITSENT_REMOVE_ACK_COMMITSENT_ADD_ACK_COMMITSENT_REMOVE_COMMIT
136msgdatachanneld_sending_commitsignum_changedu16
137msgdatachanneld_sending_commitsigchangedchanged_htlcnum_changed
138# Wait for replyto make sure it's on disk before we send commit.
139msgtypechanneld_sending_commitsig_reply1120
140# When we have a commitment_signed messagetell master to remember.
141msgtypechanneld_got_commitsig1021
142msgdatachanneld_got_commitsigcommitnumu64
143msgdatachanneld_got_commitsigfee_statesfee_states
144msgdatachanneld_got_commitsigblockheight_statesheight_states
145msgdatachanneld_got_commitsigsignaturebitcoin_signature
146msgdatachanneld_got_commitsignum_htlcsu16
147msgdatachanneld_got_commitsightlc_signaturebitcoin_signaturenum_htlcs
148# RCVD_ADD_COMMIT: we're now committed to their new offered HTLCs.
149msgdatachanneld_got_commitsignum_addedu16
150msgdatachanneld_got_commitsigaddedadded_htlcnum_added
151# RCVD_REMOVE_COMMIT: we're now no longer committed to these HTLCs.
152msgdatachanneld_got_commitsignum_fulfilledu16
153msgdatachanneld_got_commitsigfulfilledfulfilled_htlcnum_fulfilled
154msgdatachanneld_got_commitsignum_failedu16
155msgdatachanneld_got_commitsigfailedfailed_htlcnum_failed
156# RCVD_ADD_ACK_COMMITRCVD_REMOVE_ACK_COMMIT
157msgdatachanneld_got_commitsignum_changedu16
158msgdatachanneld_got_commitsigchangedchanged_htlcnum_changed
159msgdatachanneld_got_commitsigtxbitcoin_tx
160# Inflight splice commitments
161msgdatachanneld_got_commitsignum_inflight_commitsigsu16
162msgdatachanneld_got_commitsiginflight_commitsigscommitsignum_inflight_commitsigs
163subtypecommitsig
164subtypedatacommitsigtxbitcoin_tx
165subtypedatacommitsigcommit_signaturebitcoin_signature
166subtypedatacommitsignum_htlcsu16
167subtypedatacommitsightlc_signaturesbitcoin_signaturenum_htlcs
168# Wait for replyto make sure it's on disk before we send revocation.
169msgtypechanneld_got_commitsig_reply1121
170#include <common/htlc_wire.h>
171msgtypechanneld_got_revoke1022
172msgdatachanneld_got_revokerevokenumu64
173msgdatachanneld_got_revokeper_commitment_secretsecret
174msgdatachanneld_got_revokenext_per_commit_pointpubkey
175# RCVD_ADD_ACK_REVOCATIONRCVD_REMOVE_ACK_REVOCATIONRCVD_ADD_REVOCATIONRCVD_REMOVE_REVOCATION
176msgdatachanneld_got_revokefee_statesfee_states
177msgdatachanneld_got_revokeblockheight_statesheight_states
178msgdatachanneld_got_revokenum_changedu16
179msgdatachanneld_got_revokechangedchanged_htlcnum_changed
180msgdatachanneld_got_revokepbase?penalty_base
181msgdatachanneld_got_revokepenalty_tx?bitcoin_tx
182# Wait for replyto make sure it's on disk before we continue
183# (eg. if we sent another commitment_signedthat would implicitly ack).
184msgtypechanneld_got_revoke_reply1122
185#include <wally_bip32.h>
186# master->channeld: helloI'd like to start a channel splice open
187msgtypechanneld_splice_init7204
188msgdatachanneld_splice_initpsbtwally_psbt
189msgdatachanneld_splice_initrelative_amounts64
190msgdatachanneld_splice_initfeerate_per_kwu32
191msgdatachanneld_splice_initforce_feeratebool
192msgdatachanneld_splice_initskip_stfubool
193# channeld->master: helloI started a channel splice open
194msgtypechanneld_splice_confirmed_init7205
195msgdatachanneld_splice_confirmed_initpsbtwally_psbt
196# master->channeld: Update an active splice
197msgtypechanneld_splice_update7206
198msgdatachanneld_splice_updatepsbtwally_psbt
199# channeld->master: Splice update complete
200msgtypechanneld_splice_confirmed_update7207
201msgdatachanneld_splice_confirmed_updatepsbtwally_psbt
202msgdatachanneld_splice_confirmed_updatecommitments_securedbool
203msgdatachanneld_splice_confirmed_updatesignatures_securedbool
204# channeld->master: Lookup a transaction
205msgtypechanneld_splice_lookup_tx7208
206msgdatachanneld_splice_lookup_txtxidbitcoin_txid
207# master->channeld: Retrieved transaction
208msgtypechanneld_splice_lookup_tx_result7209
209msgdatachanneld_splice_lookup_tx_resulttxbitcoin_tx
210# master->channeld: User has signed psbt and it's ready to complete
211msgtypechanneld_splice_signed7212
212msgdatachanneld_splice_signedpsbtwally_psbt
213msgdatachanneld_splice_signedforce_sign_firstbool
214# channeld->master: Signed psbt is completed
215msgtypechanneld_splice_confirmed_signed7213
216msgdatachanneld_splice_confirmed_signedtxbitcoin_tx
217msgdatachanneld_splice_confirmed_signedoutput_indexu32
218# channeld->master: Splice signatures are about to be sent
219msgtypechanneld_splice_sending_sigs7214
220msgdatachanneld_splice_sending_sigstxbitcoin_txid
221# channeld->master: A feerate error has occured
222msgtypechanneld_splice_feerate_error7215
223msgdatachanneld_splice_feerate_errorfeeamount_msat
224msgdatachanneld_splice_feerate_errortoo_highbool
225# channeld->master: Add an inflight to the DB
226msgtypechanneld_add_inflight7216
227msgdatachanneld_add_inflightremote_fundingpubkey
228msgdatachanneld_add_inflighttx_idbitcoin_txid
229msgdatachanneld_add_inflighttx_outnumu32
230msgdatachanneld_add_inflightfeerateu32
231msgdatachanneld_add_inflightsatoshisamount_sat
232msgdatachanneld_add_inflightsplice_amounts64
233msgdatachanneld_add_inflightpsbtwally_psbt
234msgdatachanneld_add_inflighti_am_initiatorbool
235msgdatachanneld_add_inflightforce_sign_firstbool
236msgdatachanneld_add_inflighti_sent_sigsbool
237# master->channeld: Inflight saved successfully
238msgtypechanneld_got_inflight7217
239# channeld->master: Update inflight with sigs
240msgtypechanneld_update_inflight7219
241msgdatachanneld_update_inflightpsbtwally_psbt
242msgdatachanneld_update_inflightlast_tx?bitcoin_tx
243msgdatachanneld_update_inflightlast_sig?bitcoin_signature
244msgdatachanneld_update_inflightlocked_scid?short_channel_id
245msgdatachanneld_update_inflighti_sent_sigsbool
246# channeld->master: A funding error has occured
247msgtypechanneld_splice_funding_error7220
248msgdatachanneld_splice_funding_errorfundingamount_msat
249msgdatachanneld_splice_funding_errorreq_fundingamount_msat
250msgdatachanneld_splice_funding_erroropener_errorbool
251# channeld->master: A splice state error has occured
252msgtypechanneld_splice_state_error7221
253msgdatachanneld_splice_state_errorstate_errorwirestring
254# channeld->master: Peer rejected our splice
255msgtypechanneld_splice_abort7223
256msgdatachanneld_splice_abortdid_i_initiatebool
257msgdatachanneld_splice_abortinflight_outpoint?bitcoin_outpoint
258msgdatachanneld_splice_abortreasonwirestring
259# master->channeld: Please enter stfu mode
260msgtypechanneld_stfu7224
261# channeld->master: Entered stfu result
262msgtypechanneld_confirmed_stfu7225
263msgdatachanneld_confirmed_stfuavailable_fundsamount_msat
264# master->channeld: Please enter perform tx_abort
265msgtypechanneld_abort7226
266# Tell peer to shut down channel.
267msgtypechanneld_send_shutdown1023
268msgdatachanneld_send_shutdownfinal_index?u32
269msgdatachanneld_send_shutdownfinal_ext_key?ext_key
270msgdatachanneld_send_shutdownshutdown_lenu16
271msgdatachanneld_send_shutdownshutdown_scriptpubkeyu8shutdown_len
272msgdatachanneld_send_shutdownwrong_funding?bitcoin_outpoint
273# Peer told us that channel is shutting down
274msgtypechanneld_got_shutdown1024
275msgdatachanneld_got_shutdownscriptpubkey_lenu16
276msgdatachanneld_got_shutdownscriptpubkeyu8scriptpubkey_len
277msgdatachanneld_got_shutdownwrong_funding?bitcoin_outpoint
278# Shutdown is completeready for closing negotiation. + peer_fd & gossip_fd.
279msgtypechanneld_shutdown_complete1025
280# Re-enable commit timer.
281msgtypechanneld_dev_reenable_commit1026
282msgtypechanneld_dev_reenable_commit_reply1126
283msgtypechanneld_feerates1027
284msgdatachanneld_feeratesfeerateu32
285msgdatachanneld_feeratesmin_feerateu32
286msgdatachanneld_feeratesmax_feerateu32
287msgdatachanneld_feeratespenalty_feerateu32
288# master -> channeld: do you have a memleak?
289msgtypechanneld_dev_memleak1033
290msgtypechanneld_dev_memleak_reply1133
291msgdatachanneld_dev_memleak_replyleakbool
292# Peer presented proof it was from the future.
293msgtypechanneld_fail_fallen_behind1028
294# When we receive announcement_signatures for channel announce
295msgtypechanneld_got_announcement1017
296msgdatachanneld_got_announcementscidshort_channel_id
297msgdatachanneld_got_announcementremote_ann_node_sigsecp256k1_ecdsa_signature
298msgdatachanneld_got_announcementremote_ann_bitcoin_sigsecp256k1_ecdsa_signature
299# Ask channeld to send a error message. Used in forgetting channel case.
300msgtypechanneld_send_error1008
301msgdatachanneld_send_errorreasonwirestring
302# Tell master channeld has sent the error message.
303msgtypechanneld_send_error_reply1108
304# Ask channeld to quiesce.
305msgtypechanneld_dev_quiesce1009
306msgtypechanneld_dev_quiesce_reply1109
307# Tell master we're upgrading the commitment tx.
308msgtypechanneld_upgraded1011
309msgdatachanneld_upgradednew_typechannel_type
310# Tell peer about our latest and greatest blockheight.
311msgtypechanneld_blockheight1012
312msgdatachanneld_blockheightblockheightu32
313# Tell channeld about peer's shachain seed.
314msgtypechanneld_dev_peer_shachain1013
315msgdatachanneld_dev_peer_shachainseedsha256