diff --git a/gossipd/gossip.c b/gossipd/gossip.c index 89ae62621..197db965c 100644 --- a/gossipd/gossip.c +++ b/gossipd/gossip.c @@ -1114,7 +1114,7 @@ static struct io_plan *gossip_init(struct daemon_conn *master, &daemon->localfeatures)) { master_badmsg(WIRE_GOSSIPCTL_INIT, msg); } - daemon->rstate = new_routing_state(daemon, &chain_hash); + daemon->rstate = new_routing_state(daemon, &chain_hash, &daemon->id); setup_listeners(daemon, port); return daemon_conn_read_next(master->conn, master); diff --git a/gossipd/routing.c b/gossipd/routing.c index 0182d87a7..736563ff2 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -26,12 +26,14 @@ static struct node_map *empty_node_map(const tal_t *ctx) } struct routing_state *new_routing_state(const tal_t *ctx, - const struct sha256_double *chain_hash) + const struct sha256_double *chain_hash, + const struct pubkey *local_id) { struct routing_state *rstate = tal(ctx, struct routing_state); rstate->nodes = empty_node_map(rstate); rstate->broadcasts = new_broadcast_state(rstate); rstate->chain_hash = *chain_hash; + rstate->local_id = *local_id; return rstate; } diff --git a/gossipd/routing.h b/gossipd/routing.h index 658ebfd44..9c51f9512 100644 --- a/gossipd/routing.h +++ b/gossipd/routing.h @@ -93,7 +93,8 @@ struct route_hop { }; struct routing_state *new_routing_state(const tal_t *ctx, - const struct sha256_double *chain_hash); + const struct sha256_double *chain_hash, + const struct pubkey *local_id); /* msatoshi must be possible (< 21 million BTC), ie < 2^60. * If it returns more than msatoshi, it overflowed. */ diff --git a/gossipd/test/run-find_route-specific.c b/gossipd/test/run-find_route-specific.c index 3581a543a..908bfa6b6 100644 --- a/gossipd/test/run-find_route-specific.c +++ b/gossipd/test/run-find_route-specific.c @@ -67,8 +67,6 @@ int main(void) secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | SECP256K1_CONTEXT_SIGN); - rstate = new_routing_state(ctx, &zerohash); - pubkey_from_hexstr("03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf", strlen("03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf"), &a); @@ -79,6 +77,7 @@ int main(void) strlen("02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06"), &c); + rstate = new_routing_state(ctx, &zerohash, &a); /* [{'active': True, 'short_id': '6990:2:1/1', 'fee_per_kw': 10, 'delay': 5, 'flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'last_update': 1504064344}, */ nc = get_or_make_connection(rstate, &c, &b); diff --git a/gossipd/test/run-find_route.c b/gossipd/test/run-find_route.c index 236f3e8e2..21785cee0 100644 --- a/gossipd/test/run-find_route.c +++ b/gossipd/test/run-find_route.c @@ -78,9 +78,9 @@ int main(void) secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | SECP256K1_CONTEXT_SIGN); - rstate = new_routing_state(ctx, &zerohash); - memset(&tmp, 'a', sizeof(tmp)); + rstate = new_routing_state(ctx, &zerohash, &a); + pubkey_from_privkey(&tmp, &a); new_node(rstate, &a);