Browse Source

daemons tour: minor typos correction

travis-debug
darosior 5 years ago
committed by Rusty Russell
parent
commit
9be28fe40f
  1. 4
      closingd/closingd.c
  2. 16
      connectd/connectd.c
  3. 12
      gossipd/gossipd.c
  4. 34
      hsmd/hsmd.c
  5. 10
      lightningd/lightningd.c

4
closingd/closingd.c

@ -171,7 +171,7 @@ static void do_reconnect(struct per_peer_state *pps,
&my_current_per_commitment_point);
sync_crypto_write(pps, take(msg));
/* They might have already send reestablish, which triggered us */
/* They might have already sent reestablish, which triggered us */
if (!channel_reestablish) {
do {
tal_free(channel_reestablish);
@ -719,7 +719,7 @@ int main(int argc, char *argv[])
status_unusual("Closing and draining peerfd gave error: %s",
strerror(errno));
/* Sending the below will kill us! */
wire_sync_write(REQ_FD, take(towire_closing_complete(NULL)));
wire_sync_write(REQ_FD, take(towire_closing_complete(NULL)));
tal_free(ctx);
daemon_shutdown();

16
connectd/connectd.c

@ -297,7 +297,7 @@ static bool get_gossipfds(struct daemon *daemon,
gossip_queries_feature
= local_feature_negotiated(localfeatures, LOCAL_GOSSIP_QUERIES);
/*~ `initial_routing_sync is supported by every node, since it was in
/*~ `initial_routing_sync` is supported by every node, since it was in
* the initial lightning specification: it means the peer wants the
* backlog of existing gossip. */
initial_routing_sync
@ -318,7 +318,7 @@ static bool get_gossipfds(struct daemon *daemon,
"Failed parsing msg gossipctl: %s",
tal_hex(tmpctx, msg));
/* Gossipd might run out of file descriptors, so it tell us, and we
/* Gossipd might run out of file descriptors, so it tells us, and we
* give up on connecting this peer. */
if (!success) {
status_broken("Gossipd did not give us an fd: losing peer %s",
@ -404,10 +404,10 @@ static struct io_plan *peer_reconnected(struct io_conn *conn,
* the peer set. When someone calls `io_wake()` on that address, it
* will call retry_peer_connected above. */
return io_wait(conn, node_set_get(&daemon->peers, id),
/*~ The notleak() wrapper is a DEVELOPER-mode hack so
* that our memory leak detection doesn't consider 'pr'
* (which is not referenced from our code) to be a
* memory leak. */
/*~ The notleak() wrapper is a DEVELOPER-mode hack so
* that our memory leak detection doesn't consider 'pr'
* (which is not referenced from our code) to be a
* memory leak. */
retry_peer_connected, notleak(pr));
}
@ -454,7 +454,7 @@ struct io_plan *peer_connected(struct io_conn *conn,
/*~ daemon_conn is a message queue for inter-daemon communication: we
* queue up the `connect_peer_connected` message to tell lightningd
* we have connected, and give the the peer and gossip fds. */
* we have connected, and give the peer and gossip fds. */
daemon_conn_send(daemon->master, take(msg));
/* io_conn_fd() extracts the fd from ccan/io's io_conn */
daemon_conn_send_fd(daemon->master, io_conn_fd(conn));
@ -1385,7 +1385,7 @@ static void try_connect_peer(struct daemon *daemon,
list_add_tail(&daemon->connecting, &connect->list);
tal_add_destructor(connect, destroy_connecting);
/* Now we kick it off by trying connect->addrs[connect->addrnum] */
/* Now we kick it off by recursively trying connect->addrs[connect->addrnum] */
try_connect_one_addr(connect);
}

12
gossipd/gossipd.c

@ -449,7 +449,7 @@ static void setup_gossip_range(struct peer *peer)
queue_peer_msg(peer, take(msg));
}
/* Create a node_announcement with the given signature. It may be NULL in the
/*~ Create a node_announcement with the given signature. It may be NULL in the
* case we need to create a provisional announcement for the HSM to sign.
* This is called twice: once with the dummy signature to get it signed and a
* second time to build the full packet with the signature. The timestamp is
@ -507,7 +507,7 @@ static void send_node_announcement(struct daemon *daemon)
if (!fromwire_hsm_node_announcement_sig_reply(msg, &sig))
status_failed(STATUS_FAIL_MASTER_IO, "HSM returned an invalid node_announcement sig");
/* We got the signature for out provisional node_announcement back
/* We got the signature for our provisional node_announcement back
* from the HSM, create the real announcement and forward it to
* gossipd so it can take care of forwarding it. */
nannounce = create_node_announcement(NULL, daemon, &sig, timestamp);
@ -772,8 +772,8 @@ static u8 *handle_channel_update_msg(struct peer *peer, const u8 *msg)
return err;
}
/*~ As a nasty compromise in the spec, we only forward channel_announce
* once we have a channel_update; the channel isn't *usable* for
/*~ As a nasty compromise in the spec, we only forward `channel_announce`
* once we have a `channel_update`; the channel isn't *usable* for
* routing until you have both anyway. For this reason, we might have
* just sent out our own channel_announce, so we check if it's time to
* send a node_announcement too. */
@ -1787,7 +1787,7 @@ static bool local_direction(struct daemon *daemon,
return false;
}
/*~ This is when channeld asks us for a channel_update for a local channel.
/*~ This is when channeld asks us for a `channel_update` for a local channel.
* It does that to fill in the error field when lightningd fails an HTLC and
* sets the UPDATE bit in the error type. lightningd is too important to
* fetch this itself, so channeld does it (channeld has to talk to us for
@ -3413,6 +3413,6 @@ int main(int argc, char *argv[])
/*~ Note that the actual routing stuff is in routing.c; you might want to
* check that out later.
*
* But that's the last of the global daemons. We now move on to the first of
* But that's the last of the global daemons. We now move on to the first of
* the per-peer daemons: openingd/openingd.c.
*/

34
hsmd/hsmd.c

@ -88,10 +88,10 @@ struct client {
* it has the complete thing; this is it. */
u8 *msg_in;
/* ~Useful for logging, but also used to derive the per-channel seed. */
/*~ Useful for logging, but also used to derive the per-channel seed. */
struct node_id id;
/* ~This is a unique value handed to us from lightningd, used for
/*~ This is a unique value handed to us from lightningd, used for
* per-channel seed generation (a single id may have multiple channels
* over time).
*
@ -128,7 +128,7 @@ static bool is_lightningd(const struct client *client)
return client == dbid_zero_clients[0];
}
/*~ FIXME: This is used by debug.c. Doesn't apply to us, but lets us link. */
/* FIXME: This is used by debug.c. Doesn't apply to us, but lets us link. */
extern void dev_disconnect_init(int fd);
void dev_disconnect_init(int fd UNUSED) { }
@ -283,7 +283,7 @@ static struct io_plan *req_reply(struct io_conn *conn,
* Internally, the ccan/io subsystem gathers all the file descriptors,
* figures out which want to write and read, asks the OS which ones
* are available, and for those file descriptors, tries to do the
* reads/writes we've asked it. It handles retry in the case where a
* reads/writes we've asked it. It handles retry in the case where a
* read or write is done partially.
*
* Since the OS does buffering internally (on my system, over 100k
@ -490,7 +490,7 @@ static void bitcoin_key(struct privkey *privkey, struct pubkey *pubkey,
}
/*~ We store our root secret in a "hsm_secret" file (like all of c-lightning,
* we run in the user's .lightningd directory). */
* we run in the user's .lightning directory). */
static void maybe_create_new_hsm(void)
{
/*~ Note that this is opened for write-only, even though the permissions
@ -659,7 +659,7 @@ static struct io_plan *handle_cannouncement_sig(struct io_conn *conn,
*
* Note that 'check-source' will actually find and check this quote
* against the spec (if available); whitespace is ignored and
* ... means some content is skipped, but it works remarkably well to
* "..." means some content is skipped, but it works remarkably well to
* track spec changes. */
/* BOLT #7:
@ -769,7 +769,7 @@ static struct io_plan *handle_channel_update_sig(struct io_conn *conn,
return req_reply(conn, c, take(towire_hsm_cupdate_sig_reply(NULL, cu)));
}
/*~ This gets the basepoints for a channel; it's not privite information really
/*~ This gets the basepoints for a channel; it's not private information really
* (we tell the peer this to establish a channel, as it sets up the keys used
* for each transaction).
*
@ -848,7 +848,7 @@ static struct io_plan *handle_sign_commitment_tx(struct io_conn *conn,
* output it's spending), so in our 'bitcoin_tx' structure it's a
* pointer, as we don't always know it (and zero is a valid amount, so
* NULL is better to mean 'unknown' and has the nice property that
* you'll crash if you assume it's there and you're wrong. */
* you'll crash if you assume it's there and you're wrong.) */
tx->input_amounts[0] = tal_dup(tx, struct amount_sat, &funding);
sign_tx_input(tx, 0, NULL, funding_wscript,
&secrets.funding_privkey,
@ -1041,7 +1041,7 @@ static struct io_plan *handle_sign_delayed_payment_to_us(struct io_conn *conn,
tx, &privkey, wscript, input_sat);
}
/*~ This is used when the a commitment transaction is onchain, and has an HTLC
/*~ This is used when a commitment transaction is onchain, and has an HTLC
* output paying to us (because we have the preimage); this signs that
* transaction, which lightningd will broadcast to collect the funds. */
static struct io_plan *handle_sign_remote_htlc_to_us(struct io_conn *conn,
@ -1125,7 +1125,7 @@ static struct io_plan *handle_sign_penalty_to_us(struct io_conn *conn,
tx, &privkey, wscript, input_sat);
}
/*~ This is used when the a commitment transaction is onchain, and has an HTLC
/*~ This is used when a commitment transaction is onchain, and has an HTLC
* output paying to them, which has timed out; this signs that transaction,
* which lightningd will broadcast to collect the funds. */
static struct io_plan *handle_sign_local_htlc_tx(struct io_conn *conn,
@ -1334,7 +1334,7 @@ static struct io_plan *send_pending_client_fd(struct io_conn *conn,
return io_send_fd(conn, fd, true, client_read_next, master);
}
/*~ This is used by by the master to create a new client connection (which
/*~ This is used by the master to create a new client connection (which
* becomes the HSM_FD for the subdaemon after forking). */
static struct io_plan *pass_client_hsmfd(struct io_conn *conn,
struct client *c,
@ -1503,7 +1503,7 @@ static struct io_plan *handle_sign_funding_tx(struct io_conn *conn,
return req_reply(conn, c, take(towire_hsm_sign_funding_reply(NULL, tx)));
}
/*~ lightningd asks us to sign a withdrawal; same as above but we in theory
/*~ lightningd asks us to sign a withdrawal; same as above but in theory
* we can do more to check the previous case is valid. */
static struct io_plan *handle_sign_withdrawal_tx(struct io_conn *conn,
struct client *c,
@ -1571,7 +1571,7 @@ static struct io_plan *handle_sign_invoice(struct io_conn *conn,
/* FIXME: Check invoice! */
/* tal_dup_arr() does what you'd expect: allocate an array by copying
/*~ tal_dup_arr() does what you'd expect: allocate an array by copying
* another; the cast is needed because the hrp is a 'char' array, not
* a 'u8' (unsigned char) as it's the "human readable" part.
*
@ -1588,7 +1588,7 @@ static struct io_plan *handle_sign_invoice(struct io_conn *conn,
node_key(&node_pkey, NULL);
/*~ By no small coincidence, this libsecp routine uses the exact
* recovery signature format mandated by BOLT 11. */
if (!secp256k1_ecdsa_sign_recoverable(secp256k1_ctx, &rsig,
if (!secp256k1_ecdsa_sign_recoverable(secp256k1_ctx, &rsig,
(const u8 *)&sha,
node_pkey.secret.data,
NULL, NULL)) {
@ -1723,8 +1723,8 @@ static bool check_client_capabilities(struct client *client,
case WIRE_HSM_DEV_MEMLEAK:
return (client->capabilities & HSM_CAP_MASTER) != 0;
/*~ These are messages sent by the HSM so we should never receive them.
* FIXME: Since we autogenerate these, we should really generate separate
/*~ These are messages sent by the HSM so we should never receive them. */
/* FIXME: Since we autogenerate these, we should really generate separate
* enums for replies to avoid this kind of clutter! */
case WIRE_HSM_ECDH_RESP:
case WIRE_HSM_CANNOUNCEMENT_SIG_REPLY:
@ -1880,7 +1880,7 @@ int main(int argc, char *argv[])
/* When conn closes, everything is freed. */
io_set_finish(master->conn, master_gone, master);
/*~ The two NULL args a list of timers, and the timer which expired:
/*~ The two NULL args are a list of timers, and the timer which expired:
* we don't have any timers. */
io_loop(NULL, NULL);

10
lightningd/lightningd.c

@ -141,7 +141,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
list_head_init(&ld->peers);
/*~ These are hash tables of incoming and outgoing HTLCs (contracts),
* defined as `struct htlc_in` and `struct htlc_out`in htlc_end.h.
* defined as `struct htlc_in` and `struct htlc_out` in htlc_end.h.
* The hash tables are declared there using the very ugly
* HTABLE_DEFINE_TYPE macro. The key is the channel the HTLC is in
* and the 64-bit htlc-id which is unique for that channel and
@ -220,10 +220,10 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
ld->original_directory = path_cwd(ld);
/*~ We run a number of plugins (subprocesses that we talk JSON-RPC with)
*alongside this process. This allows us to have an easy way for users
*to add their own tools without having to modify the c-lightning source
*code. Here we initialize the context that will keep track and control
*the plugins.
* alongside this process. This allows us to have an easy way for users
* to add their own tools without having to modify the c-lightning source
* code. Here we initialize the context that will keep track and control
* the plugins.
*/
ld->plugins = plugins_new(ld, ld->log_book, ld);
ld->plugins->startup = true;

Loading…
Cancel
Save