gossipd: hand a gossip_store_fd to all subdaemons.

This will let them read from the gossip store directly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-05-04 15:23:13 +09:30
parent eaac0d7105
commit 13717c6ebb
24 changed files with 114 additions and 61 deletions

View File

@@ -47,11 +47,12 @@
#include <wire/wire.h>
#include <wire/wire_sync.h>
/* stdin == lightningd, 3 == peer, 4 == gossipd, 5 = hsmd */
/* stdin == lightningd, 3 == peer, 4 == gossipd, 5 = gossip_store, 6 = hsmd */
#define REQ_FD STDIN_FILENO
#define PEER_FD 3
#define GOSSIP_FD 4
#define HSM_FD 5
#define GOSSIP_STORE_FD 5
#define HSM_FD 6
/* Global state structure. This is only for the one specific peer and channel */
struct state {
@@ -408,6 +409,7 @@ static u8 *opening_negotiate_msg(const tal_t *ctx, struct state *state,
wire_sync_write(REQ_FD, take(msg));
}
peer_failed_received_errmsg(PEER_FD, GOSSIP_FD,
GOSSIP_STORE_FD,
&state->cs, err,
NULL);
}
@@ -1306,7 +1308,9 @@ static u8 *handle_peer_in(struct state *state)
case WIRE_UPDATE_FEE:
case WIRE_ANNOUNCEMENT_SIGNATURES:
/* Standard cases */
if (handle_peer_gossip_or_error(PEER_FD, GOSSIP_FD, &state->cs,
if (handle_peer_gossip_or_error(PEER_FD, GOSSIP_FD,
GOSSIP_STORE_FD,
&state->cs,
&state->channel_id, msg))
return NULL;
break;
@@ -1542,6 +1546,7 @@ int main(int argc, char *argv[])
wire_sync_write(REQ_FD, msg);
fdpass_send(REQ_FD, PEER_FD);
fdpass_send(REQ_FD, GOSSIP_FD);
fdpass_send(REQ_FD, GOSSIP_STORE_FD);
status_trace("Sent %s with fd",
opening_wire_type_name(fromwire_peektype(msg)));