2017-01-10 06:08:33 +01:00
|
|
|
#ifndef LIGHTNING_LIGHTNINGD_GOSSIP_CONTROL_H
|
|
|
|
#define LIGHTNING_LIGHTNINGD_GOSSIP_CONTROL_H
|
|
|
|
#include "config.h"
|
2018-03-28 12:03:40 +02:00
|
|
|
#include <bitcoin/short_channel_id.h>
|
gossipd: rewrite to do the handshake internally.
Now the flow is much simpler from a lightningd POV:
1. If we want to connect to a peer, just send gossipd `gossipctl_reach_peer`.
2. Every new peer, gossipd hands up to lightningd, with global/local features
and the peer fd and a gossip fd using `gossip_peer_connected`
3. If lightningd doesn't want it, it just hands the peerfd and global/local
features back to gossipd using `gossipctl_handle_peer`
4. If a peer sends a non-gossip msg (eg `open_channel`) the gossipd sends
it up using `gossip_peer_nongossip`.
5. If lightningd wants to fund a channel, it simply calls `release_channel`.
Notes:
* There's no more "unique_id": we use the peer id.
* For the moment, we don't ask gossipd when we're told to list peers, so
connected peers without a channel don't appear in the JSON getpeers API.
* We add a `gossipctl_peer_addrhint` for the moment, so you can connect to
a specific ip/port, but using other sources is a TODO.
* We now (correctly) only give up on reaching a peer after we exchange init
messages, which changes the test_disconnect case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-11 12:09:49 +02:00
|
|
|
#include <ccan/short_types/short_types.h>
|
2017-01-10 06:08:33 +01:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2022-01-24 21:03:52 +01:00
|
|
|
struct channel;
|
2017-01-10 06:08:33 +01:00
|
|
|
struct lightningd;
|
|
|
|
|
2022-01-29 04:33:05 +01:00
|
|
|
void gossip_init(struct lightningd *ld, int connectd_fd);
|
2018-03-28 12:03:40 +02:00
|
|
|
|
|
|
|
void gossipd_notify_spend(struct lightningd *ld,
|
|
|
|
const struct short_channel_id *scid);
|
|
|
|
|
2019-09-22 04:06:43 +02:00
|
|
|
void gossip_notify_new_block(struct lightningd *ld, u32 blockheight);
|
|
|
|
|
2022-01-24 21:03:52 +01:00
|
|
|
/* channeld tells us stuff, we tell gossipd. */
|
|
|
|
void tell_gossipd_local_channel_update(struct lightningd *ld,
|
|
|
|
struct channel *channel,
|
|
|
|
const u8 *msg);
|
|
|
|
void tell_gossipd_local_channel_announce(struct lightningd *ld,
|
|
|
|
struct channel *channel,
|
|
|
|
const u8 *msg);
|
|
|
|
void tell_gossipd_local_private_channel(struct lightningd *ld,
|
|
|
|
struct channel *channel,
|
|
|
|
struct amount_sat capacity,
|
|
|
|
const u8 *features);
|
|
|
|
|
2017-08-28 18:06:01 +02:00
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_GOSSIP_CONTROL_H */
|