Skip to content

Larger internal messages #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 29, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions channeld/channel_wire.csv
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ channel_normal_operation,11001
channel_init,1000
channel_init,,chain_hash,struct sha256_double
channel_init,,funding_txid,struct sha256_double
channel_init,,funding_txout,2
channel_init,,funding_satoshi,8
channel_init,,funding_txout,u16
channel_init,,funding_satoshi,u64
channel_init,,our_config,struct channel_config
channel_init,,their_config,struct channel_config
channel_init,,feerate_per_kw,4
channel_init,,feerate_per_kw,u32
channel_init,,first_commit_sig,secp256k1_ecdsa_signature
channel_init,,crypto_state,struct crypto_state
channel_init,,remote_fundingkey,33
channel_init,,revocation_basepoint,33
channel_init,,payment_basepoint,33
channel_init,,delayed_payment_basepoint,33
channel_init,,remote_per_commit,33
channel_init,,old_remote_per_commit,33
channel_init,,remote_fundingkey,struct pubkey
channel_init,,revocation_basepoint,struct pubkey
channel_init,,payment_basepoint,struct pubkey
channel_init,,delayed_payment_basepoint,struct pubkey
channel_init,,remote_per_commit,struct pubkey
channel_init,,old_remote_per_commit,struct pubkey
channel_init,,funder,enum side
channel_init,,fee_base,4
channel_init,,fee_proportional,4
channel_init,,local_msatoshi,8
channel_init,,fee_base,u32
channel_init,,fee_proportional,u32
channel_init,,local_msatoshi,u64
channel_init,,seed,struct privkey
channel_init,,local_node_id,struct pubkey
channel_init,,remote_node_id,struct pubkey
channel_init,,commit_msec,4
channel_init,,commit_msec,u32
channel_init,,cltv_delta,u16
channel_init,,last_was_revoke,bool
channel_init,,num_last_sent_commit,u16
Expand Down Expand Up @@ -66,32 +66,32 @@ channel_funding_announce_depth,1003

# Tell channel to offer this htlc
channel_offer_htlc,1004
channel_offer_htlc,,amount_msat,8
channel_offer_htlc,,cltv_expiry,4
channel_offer_htlc,,payment_hash,32
channel_offer_htlc,,amount_msat,u64
channel_offer_htlc,,cltv_expiry,u32
channel_offer_htlc,,payment_hash,struct sha256
channel_offer_htlc,,onion_routing_packet,1366*u8

# Reply; synchronous since IDs have to increment.
channel_offer_htlc_reply,1104
channel_offer_htlc_reply,,id,8
channel_offer_htlc_reply,,id,u64
# Zero failure code means success.
channel_offer_htlc_reply,,failure_code,2
channel_offer_htlc_reply,,failurestrlen,2
channel_offer_htlc_reply,,failure_code,u16
channel_offer_htlc_reply,,failurestrlen,u16
channel_offer_htlc_reply,,failurestr,failurestrlen*u8

# Main daemon found out the preimage for an htlc
#include <bitcoin/preimage.h>
channel_fulfill_htlc,1005
channel_fulfill_htlc,,id,8
channel_fulfill_htlc,,id,u64
channel_fulfill_htlc,,payment_preimage,struct preimage

# Main daemon says HTLC failed
channel_fail_htlc,1006
channel_fail_htlc,,id,8
channel_fail_htlc,,id,u64
# If malformed is non-zero, it's a BADONION code
channel_fail_htlc,,malformed,u16
# Otherwise, error_pkt contains failreason.
channel_fail_htlc,,len,2
channel_fail_htlc,,len,u16
channel_fail_htlc,,error_pkt,len*u8

# Ping/pong test.
Expand Down
34 changes: 17 additions & 17 deletions gossipd/gossip_wire.csv
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
# Peers can give a bad message, we close their fd, but no harm done.
gossipstatus_peer_bad_msg,13000
gossipstatus_peer_bad_msg,,unique_id,8
gossipstatus_peer_bad_msg,,len,2
gossipstatus_peer_bad_msg,,unique_id,u64
gossipstatus_peer_bad_msg,,len,u16
gossipstatus_peer_bad_msg,,err,len*u8

# Misc problems like opening control fd.
gossipstatus_peer_failed,13001
gossipstatus_peer_failed,,unique_id,8
gossipstatus_peer_failed,,len,2
gossipstatus_peer_failed,,unique_id,u64
gossipstatus_peer_failed,,len,u16
gossipstatus_peer_failed,,err,len*u8

#include <common/cryptomsg.h>

# Initialize the gossip daemon
gossipctl_init,3000
gossipctl_init,,broadcast_interval,4
gossipctl_init,,broadcast_interval,u32
gossipctl_init,,chain_hash,struct sha256_double

# These take an fd, but have no response
# (if it is to move onto a channel, we get a status msg).
gossipctl_new_peer,3001
gossipctl_new_peer,,unique_id,8
gossipctl_new_peer,,unique_id,u64
gossipctl_new_peer,,crypto_state,struct crypto_state

# Tell it to release a peer which has initialized.
gossipctl_release_peer,3002
gossipctl_release_peer,,unique_id,8
gossipctl_release_peer,,unique_id,u64

# This releases the peer and returns the cryptostate (followed two fds: peer and gossip)
gossipctl_release_peer_reply,3102
Expand All @@ -36,17 +36,17 @@ gossipctl_release_peer_replyfail,3202

# This is where we save a peer's features.
#gossipstatus_peer_features,3001
#gossipstatus_peer_features,,unique_id,8
#gossipstatus_peer_features,,gflen,2
#gossipstatus_peer_features,,globalfeatures,gflen
#gossipstatus_peer_features,,lflen,2
#gossipstatus_peer_features,,localfeatures,lflen
#gossipstatus_peer_features,,unique_id,u64
#gossipstatus_peer_features,,gflen,u16
#gossipstatus_peer_features,,globalfeatures,gflen*u8
#gossipstatus_peer_features,,lflen,u16
#gossipstatus_peer_features,,localfeatures,lflen*u8

# Peer can send non-gossip packet (usually an open_channel) (followed two fds: peer and gossip)
gossipstatus_peer_nongossip,3004
gossipstatus_peer_nongossip,,unique_id,8
gossipstatus_peer_nongossip,,unique_id,u64
gossipstatus_peer_nongossip,,crypto_state,struct crypto_state
gossipstatus_peer_nongossip,,len,2
gossipstatus_peer_nongossip,,len,u16
gossipstatus_peer_nongossip,,msg,len*u8

# Pass JSON-RPC getnodes call through
Expand Down Expand Up @@ -94,12 +94,12 @@ gossip_resolve_channel_reply,,keys,num_keys*struct pubkey
# The main daemon forward some gossip message to gossipd, allows injecting
# arbitrary gossip messages.
gossip_forwarded_msg,3010
gossip_forwarded_msg,,msglen,2
gossip_forwarded_msg,,msg,msglen
gossip_forwarded_msg,,msglen,u16
gossip_forwarded_msg,,msg,msglen*u8

# If peer is still connected, fail it (master does this for reconnect)
gossipctl_fail_peer,3011
gossipctl_fail_peer,,unique_id,8
gossipctl_fail_peer,,unique_id,u64

# Get a gossip fd for this peer (it has reconnected)
gossipctl_get_peer_gossipfd,3012
Expand Down
24 changes: 12 additions & 12 deletions handshaked/handshake_wire.csv
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ respr_act_three,14013
success,4000

handshake_responder,4001
handshake_responder,,my_id,33
handshake_responder,,my_id,struct pubkey
handshake_responder_reply,4101
handshake_responder_reply,,initiator_id,33
handshake_responder_reply,,initiator_id,struct pubkey
handshake_responder_reply,,cs,struct crypto_state
handshake_responder_reply,,gflen,2
handshake_responder_reply,,globalfeatures,gflen
handshake_responder_reply,,lflen,2
handshake_responder_reply,,localfeatures,lflen
handshake_responder_reply,,gflen,u16
handshake_responder_reply,,globalfeatures,gflen*u8
handshake_responder_reply,,lflen,u16
handshake_responder_reply,,localfeatures,lflen*u8

handshake_initiator,4002
handshake_initiator,,my_id,33
handshake_initiator,,responder_id,33
handshake_initiator,,my_id,struct pubkey
handshake_initiator,,responder_id,struct pubkey

handshake_initiator_reply,4102
handshake_initiator_reply,,cs,struct crypto_state
handshake_initiator_reply,,gflen,2
handshake_initiator_reply,,globalfeatures,gflen
handshake_initiator_reply,,lflen,2
handshake_initiator_reply,,localfeatures,lflen
handshake_initiator_reply,,gflen,u16
handshake_initiator_reply,,globalfeatures,gflen*u8
handshake_initiator_reply,,lflen,u16
handshake_initiator_reply,,localfeatures,lflen*u8
8 changes: 4 additions & 4 deletions hsmd/hsm_client_wire_csv
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ hsm_ecdh_resp,,ss,struct secret
hsm_cannouncement_sig_req,2
hsm_cannouncement_sig_req,,bitcoin_id,struct pubkey
hsm_cannouncement_sig_req,,calen,u16
hsm_cannouncement_sig_req,,ca,calen
hsm_cannouncement_sig_req,,ca,calen*u8

hsm_cannouncement_sig_reply,102
hsm_cannouncement_sig_reply,,node_signature,64
hsm_cannouncement_sig_reply,,node_signature,secp256k1_ecdsa_signature

hsm_cupdate_sig_req,3
hsm_cupdate_sig_req,,culen,u16
hsm_cupdate_sig_req,,cu,culen
hsm_cupdate_sig_req,,cu,culen*u8

hsm_cupdate_sig_reply,103
hsm_cupdate_sig_reply,,culen,u16
hsm_cupdate_sig_reply,,cu,culen
hsm_cupdate_sig_reply,,cu,culen*u8
36 changes: 18 additions & 18 deletions hsmd/hsm_wire.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Clients should not give a bad request but not the HSM's decision to crash.
hsmstatus_client_bad_request,1000
hsmstatus_client_bad_request,,unique_id,8
hsmstatus_client_bad_request,,len,2
hsmstatus_client_bad_request,,unique_id,u64
hsmstatus_client_bad_request,,len,u16
hsmstatus_client_bad_request,,msg,len*u8

# Start the HSM.
Expand All @@ -10,13 +10,13 @@ hsmctl_init,,new,bool

#include <common/bip32.h>
hsmctl_init_reply,101
hsmctl_init_reply,,node_id,33
hsmctl_init_reply,,node_id,struct pubkey
hsmctl_init_reply,,peer_seed,struct secret
hsmctl_init_reply,,bip32,struct ext_key

# ECDH returns an fd.
hsmctl_hsmfd_ecdh,3
hsmctl_hsmfd_ecdh,,unique_id,8
hsmctl_hsmfd_ecdh,,unique_id,u64

# No contents, just an fd.
hsmctl_hsmfd_ecdh_fd_reply,103
Expand All @@ -25,42 +25,42 @@ hsmctl_hsmfd_ecdh_fd_reply,103
#include <common/utxo.h>
# FIXME: This should also take their commit sig & details, to verify.
hsmctl_sign_funding,4
hsmctl_sign_funding,,satoshi_out,8
hsmctl_sign_funding,,change_out,8
hsmctl_sign_funding,,change_keyindex,4
hsmctl_sign_funding,,our_pubkey,33
hsmctl_sign_funding,,their_pubkey,33
hsmctl_sign_funding,,num_inputs,2
hsmctl_sign_funding,,satoshi_out,u64
hsmctl_sign_funding,,change_out,u64
hsmctl_sign_funding,,change_keyindex,u32
hsmctl_sign_funding,,our_pubkey,struct pubkey
hsmctl_sign_funding,,their_pubkey,struct pubkey
hsmctl_sign_funding,,num_inputs,u16
hsmctl_sign_funding,,inputs,num_inputs*struct utxo

hsmctl_sign_funding_reply,104
hsmctl_sign_funding_reply,,num_sigs,2
hsmctl_sign_funding_reply,,num_sigs,u16
hsmctl_sign_funding_reply,,sig,num_sigs*secp256k1_ecdsa_signature

# Request a client socket for a `channeld`, allows signing announcements
hsmctl_hsmfd_channeld,5
hsmctl_hsmfd_channeld,,unique_id,8
hsmctl_hsmfd_channeld,,unique_id,u64

# Empty reply, just an fd
hsmctl_hsmfd_channeld_reply,105

# Master asks the HSM to sign a node_announcement
hsmctl_node_announcement_sig_req,6
hsmctl_node_announcement_sig_req,,annlen,2
hsmctl_node_announcement_sig_req,,annlen,u16
hsmctl_node_announcement_sig_req,,announcement,annlen*u8

hsmctl_node_announcement_sig_reply,106
hsmctl_node_announcement_sig_reply,,signature,secp256k1_ecdsa_signature

# Sign a withdrawal request
hsmctl_sign_withdrawal,7
hsmctl_sign_withdrawal,,satoshi_out,8
hsmctl_sign_withdrawal,,change_out,8
hsmctl_sign_withdrawal,,change_keyindex,4
hsmctl_sign_withdrawal,,satoshi_out,u64
hsmctl_sign_withdrawal,,change_out,u64
hsmctl_sign_withdrawal,,change_keyindex,u32
hsmctl_sign_withdrawal,,pkh,20*u8
hsmctl_sign_withdrawal,,num_inputs,2
hsmctl_sign_withdrawal,,num_inputs,u16
hsmctl_sign_withdrawal,,inputs,num_inputs*struct utxo

hsmctl_sign_withdrawal_reply,107
hsmctl_sign_withdrawal_reply,,num_sigs,2
hsmctl_sign_withdrawal_reply,,num_sigs,u16
hsmctl_sign_withdrawal_reply,,sig,num_sigs*secp256k1_ecdsa_signature
5 changes: 0 additions & 5 deletions lightningd/peer_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -2525,11 +2525,6 @@ void peer_fundee_open(struct peer *peer, const u8 *from_peer,
msg = towire_opening_fundee(peer, peer->minimum_depth,
7500, 150000, from_peer);

/* Careful here! Their message could push us overlength! */
if (tal_len(msg) >= 65536) {
peer_fail_permanent_str(peer, "Unacceptably long open_channel");
return;
}
subd_req(peer, peer->owner, take(msg), -1, 2,
opening_fundee_finished, peer);
}
Expand Down
Loading