core-lightning/channeld/channeld_wire.csv
niftynei 864f2f3e21 channel_id: save to database, dont derive from funding_txid
v2 channel open uses a different method to derive the channel_id, so now
we save it to the database so that we dont have to remember how to
derive it for each.

includes a migration for existing channels
2020-09-09 19:54:20 +09:30

9.8 KiB

1#include <common/cryptomsg.h>
2#include <common/channel_config.h>
3#include <common/channel_id.h>
4#include <common/derive_basepoints.h>
5#include <common/features.h>
6#include <common/fee_states.h>
7#include <common/per_peer_state.h>
8# Begin! (passes gossipd-client fd)
9msgtype,channeld_init,1000
10msgdata,channeld_init,chainparams,chainparams,
11msgdata,channeld_init,our_features,feature_set,
12msgdata,channeld_init,channel_id,channel_id,
13msgdata,channeld_init,funding_txid,bitcoin_txid,
14msgdata,channeld_init,funding_txout,u16,
15msgdata,channeld_init,funding_satoshi,amount_sat,
16msgdata,channeld_init,minimum_depth,u32,
17msgdata,channeld_init,our_config,channel_config,
18msgdata,channeld_init,their_config,channel_config,
19msgdata,channeld_init,fee_states,fee_states,
20msgdata,channeld_init,feerate_min,u32,
21msgdata,channeld_init,feerate_max,u32,
22msgdata,channeld_init,feerate_penalty,u32,
23msgdata,channeld_init,first_commit_sig,bitcoin_signature,
24msgdata,channeld_init,per_peer_state,per_peer_state,
25msgdata,channeld_init,remote_fundingkey,pubkey,
26msgdata,channeld_init,remote_basepoints,basepoints,
27msgdata,channeld_init,remote_per_commit,pubkey,
28msgdata,channeld_init,old_remote_per_commit,pubkey,
29msgdata,channeld_init,opener,enum side,
30msgdata,channeld_init,fee_base,u32,
31msgdata,channeld_init,fee_proportional,u32,
32msgdata,channeld_init,local_msatoshi,amount_msat,
33msgdata,channeld_init,our_basepoints,basepoints,
34msgdata,channeld_init,our_funding_pubkey,pubkey,
35msgdata,channeld_init,local_node_id,node_id,
36msgdata,channeld_init,remote_node_id,node_id,
37msgdata,channeld_init,commit_msec,u32,
38msgdata,channeld_init,cltv_delta,u16,
39msgdata,channeld_init,last_was_revoke,bool,
40msgdata,channeld_init,num_last_sent_commit,u16,
41msgdata,channeld_init,last_sent_commit,changed_htlc,num_last_sent_commit
42msgdata,channeld_init,next_index_local,u64,
43msgdata,channeld_init,next_index_remote,u64,
44msgdata,channeld_init,revocations_received,u64,
45msgdata,channeld_init,next_htlc_id,u64,
46msgdata,channeld_init,num_existing_htlcs,u16,
47msgdata,channeld_init,htlcs,existing_htlc,num_existing_htlcs
48msgdata,channeld_init,local_funding_locked,bool,
49msgdata,channeld_init,remote_funding_locked,bool,
50msgdata,channeld_init,funding_short_id,short_channel_id,
51msgdata,channeld_init,reestablish,bool,
52msgdata,channeld_init,send_shutdown,bool,
53msgdata,channeld_init,remote_shutdown_received,bool,
54msgdata,channeld_init,final_scriptpubkey_len,u16,
55msgdata,channeld_init,final_scriptpubkey,u8,final_scriptpubkey_len
56msgdata,channeld_init,flags,u8,
57msgdata,channeld_init,init_peer_pkt_len,u16,
58msgdata,channeld_init,init_peer_pkt,u8,init_peer_pkt_len
59msgdata,channeld_init,reached_announce_depth,bool,
60msgdata,channeld_init,last_remote_secret,secret,
61msgdata,channeld_init,flen,u16,
62msgdata,channeld_init,their_features,u8,flen
63msgdata,channeld_init,upfront_shutdown_script_len,u16,
64msgdata,channeld_init,upfront_shutdown_script,u8,upfront_shutdown_script_len
65msgdata,channeld_init,remote_ann_node_sig,?secp256k1_ecdsa_signature,
66msgdata,channeld_init,remote_ann_bitcoin_sig,?secp256k1_ecdsa_signature,
67msgdata,channeld_init,option_static_remotekey,bool,
68msgdata,channeld_init,option_anchor_outputs,bool,
69msgdata,channeld_init,dev_fast_gossip,bool,
70msgdata,channeld_init,dev_fail_process_onionpacket,bool,
71msgdata,channeld_init,num_penalty_bases,u32,
72msgdata,channeld_init,pbases,penalty_base,num_penalty_bases
73# master->channeld funding hit new depth(funding locked if >= lock depth)
74msgtype,channeld_funding_depth,1002
75msgdata,channeld_funding_depth,short_channel_id,?short_channel_id,
76msgdata,channeld_funding_depth,depth,u32,
77# Tell channel to offer this htlc
78msgtype,channeld_offer_htlc,1004
79msgdata,channeld_offer_htlc,amount_msat,amount_msat,
80msgdata,channeld_offer_htlc,cltv_expiry,u32,
81msgdata,channeld_offer_htlc,payment_hash,sha256,
82msgdata,channeld_offer_htlc,onion_routing_packet,u8,1366
83msgdata,channeld_offer_htlc,blinding,?pubkey,
84# Reply; synchronous since IDs have to increment.
85msgtype,channeld_offer_htlc_reply,1104
86msgdata,channeld_offer_htlc_reply,id,u64,
87# Empty failure message means success.
88msgdata,channeld_offer_htlc_reply,len,u16,
89msgdata,channeld_offer_htlc_reply,failuremsg,u8,len
90msgdata,channeld_offer_htlc_reply,failurestr,wirestring,
91# Main daemon found out the preimage for an HTLC
92#include <bitcoin/preimage.h>
93msgtype,channeld_fulfill_htlc,1005
94msgdata,channeld_fulfill_htlc,fulfilled_htlc,fulfilled_htlc,
95# Main daemon says HTLC failed
96msgtype,channeld_fail_htlc,1006
97msgdata,channeld_fail_htlc,failed_htlc,failed_htlc,
98# When we receive funding_locked.
99msgtype,channeld_got_funding_locked,1019
100msgdata,channeld_got_funding_locked,next_per_commit_point,pubkey,
101#include <common/penalty_base.h>
102# When we send a commitment_signed message, tell master.
103msgtype,channeld_sending_commitsig,1020
104msgdata,channeld_sending_commitsig,commitnum,u64,
105msgdata,channeld_sending_commitsig,pbase,?penalty_base,
106msgdata,channeld_sending_commitsig,fee_states,fee_states,
107# SENT_ADD_COMMIT, SENT_REMOVE_ACK_COMMIT, SENT_ADD_ACK_COMMIT, SENT_REMOVE_COMMIT
108msgdata,channeld_sending_commitsig,num_changed,u16,
109msgdata,channeld_sending_commitsig,changed,changed_htlc,num_changed
110msgdata,channeld_sending_commitsig,commit_sig,bitcoin_signature,
111msgdata,channeld_sending_commitsig,num_htlc_sigs,u16,
112msgdata,channeld_sending_commitsig,htlc_sigs,bitcoin_signature,num_htlc_sigs
113# Wait for reply, to make sure it's on disk before we send commit.
114msgtype,channeld_sending_commitsig_reply,1120
115# When we have a commitment_signed message, tell master to remember.
116msgtype,channeld_got_commitsig,1021
117msgdata,channeld_got_commitsig,commitnum,u64,
118msgdata,channeld_got_commitsig,fee_states,fee_states,
119msgdata,channeld_got_commitsig,signature,bitcoin_signature,
120msgdata,channeld_got_commitsig,num_htlcs,u16,
121msgdata,channeld_got_commitsig,htlc_signature,bitcoin_signature,num_htlcs
122# RCVD_ADD_COMMIT: we're now committed to their new offered HTLCs.
123msgdata,channeld_got_commitsig,num_added,u16,
124msgdata,channeld_got_commitsig,added,added_htlc,num_added
125# RCVD_REMOVE_COMMIT: we're now no longer committed to these HTLCs.
126msgdata,channeld_got_commitsig,num_fulfilled,u16,
127msgdata,channeld_got_commitsig,fulfilled,fulfilled_htlc,num_fulfilled
128msgdata,channeld_got_commitsig,num_failed,u16,
129msgdata,channeld_got_commitsig,failed,failed_htlc,num_failed
130# RCVD_ADD_ACK_COMMIT, RCVD_REMOVE_ACK_COMMIT
131msgdata,channeld_got_commitsig,num_changed,u16,
132msgdata,channeld_got_commitsig,changed,changed_htlc,num_changed
133msgdata,channeld_got_commitsig,tx,bitcoin_tx,
134# Wait for reply, to make sure it's on disk before we send revocation.
135msgtype,channeld_got_commitsig_reply,1121
136#include <common/htlc_wire.h>
137msgtype,channeld_got_revoke,1022
138msgdata,channeld_got_revoke,revokenum,u64,
139msgdata,channeld_got_revoke,per_commitment_secret,secret,
140msgdata,channeld_got_revoke,next_per_commit_point,pubkey,
141# RCVD_ADD_ACK_REVOCATION, RCVD_REMOVE_ACK_REVOCATION, RCVD_ADD_REVOCATION, RCVD_REMOVE_REVOCATION
142msgdata,channeld_got_revoke,fee_states,fee_states,
143msgdata,channeld_got_revoke,num_changed,u16,
144msgdata,channeld_got_revoke,changed,changed_htlc,num_changed
145msgdata,channeld_got_revoke,pbase,?penalty_base,
146msgdata,channeld_got_revoke,penalty_tx,?bitcoin_tx,
147# Wait for reply, to make sure it's on disk before we continue
148# (eg. if we sent another commitment_signed, that would implicitly ack).
149msgtype,channeld_got_revoke_reply,1122
150# Tell peer to shut down channel.
151msgtype,channeld_send_shutdown,1023
152msgdata,channeld_send_shutdown,shutdown_len,u16,
153msgdata,channeld_send_shutdown,shutdown_scriptpubkey,u8,shutdown_len
154# Peer told us that channel is shutting down
155msgtype,channeld_got_shutdown,1024
156msgdata,channeld_got_shutdown,scriptpubkey_len,u16,
157msgdata,channeld_got_shutdown,scriptpubkey,u8,scriptpubkey_len
158# Shutdown is complete, ready for closing negotiation. + peer_fd & gossip_fd.
159msgtype,channeld_shutdown_complete,1025
160msgdata,channeld_shutdown_complete,per_peer_state,per_peer_state,
161# Re-enable commit timer.
162msgtype,channeld_dev_reenable_commit,1026
163msgtype,channeld_dev_reenable_commit_reply,1126,
164msgtype,channeld_feerates,1027
165msgdata,channeld_feerates,feerate,u32,
166msgdata,channeld_feerates,min_feerate,u32,
167msgdata,channeld_feerates,max_feerate,u32,
168msgdata,channeld_feerates,penalty_feerate,u32,
169# master -> channeld: do you have a memleak?
170msgtype,channeld_dev_memleak,1033
171msgtype,channeld_dev_memleak_reply,1133
172msgdata,channeld_dev_memleak_reply,leak,bool,
173# Peer presented proof it was from the future.
174msgtype,channeld_fail_fallen_behind,1028
175# This is NULL if option_static_remotekey.
176msgdata,channeld_fail_fallen_behind,remote_per_commitment_point,?pubkey,
177# Handle a channel specific feerate base ppm configuration
178msgtype,channeld_specific_feerates,1029
179msgdata,channeld_specific_feerates,feerate_base,u32,
180msgdata,channeld_specific_feerates,feerate_ppm,u32,
181# When we receive announcement_signatures for channel announce
182msgtype,channeld_got_announcement,1017
183msgdata,channeld_got_announcement,remote_ann_node_sig,secp256k1_ecdsa_signature,
184msgdata,channeld_got_announcement,remote_ann_bitcoin_sig,secp256k1_ecdsa_signature,
185# Ask channeld to send a error message. Used in forgetting channel case.
186msgtype,channeld_send_error,1008
187msgdata,channeld_send_error,reason,wirestring,
188# Tell master channeld has sent the error message.
189msgtype,channeld_send_error_reply,1108
190# Tell lightningd we got a onion message (for us, or to fwd)
191msgtype,got_onionmsg_to_us,1142
192msgdata,got_onionmsg_to_us,reply_blinding,?pubkey,
193msgdata,got_onionmsg_to_us,reply_path_len,u16,
194msgdata,got_onionmsg_to_us,reply_path,onionmsg_path,reply_path_len
195msgtype,got_onionmsg_forward,1143
196msgdata,got_onionmsg_forward,next_scid,?short_channel_id,
197msgdata,got_onionmsg_forward,next_node_id,?node_id,
198msgdata,got_onionmsg_forward,next_blinding,?pubkey,
199msgdata,got_onionmsg_forward,next_onion,u8,1366
200# Lightningd tells us to send a onion message.
201msgtype,send_onionmsg,1040
202msgdata,send_onionmsg,onion,u8,1366
203msgdata,send_onionmsg,blinding,?pubkey,