diff --git a/gossipd/gossip_generation.c b/gossipd/gossip_generation.c index 6ca0ff3e5..22497709e 100644 --- a/gossipd/gossip_generation.c +++ b/gossipd/gossip_generation.c @@ -3,6 +3,7 @@ #include "config.h" #include #include +#include #include #include #include @@ -15,6 +16,7 @@ #include #include #include +#include #include #include @@ -418,6 +420,11 @@ static u8 *sign_and_timestamp_update(const tal_t *ctx, if (taken(unsigned_update)) tal_free(unsigned_update); + /* Tell lightningd about this immediately (even if we're not actually + * applying it now) */ + msg = towire_gossipd_got_local_channel_update(NULL, &chan->scid, update); + daemon_conn_send(daemon->master, take(msg)); + return update; } diff --git a/gossipd/test/run-check_node_announcement.c b/gossipd/test/run-check_node_announcement.c index 95b2bdc19..ac5c80f27 100644 --- a/gossipd/test/run-check_node_announcement.c +++ b/gossipd/test/run-check_node_announcement.c @@ -24,6 +24,9 @@ bool blinding_next_pubkey(const struct pubkey *pk UNNEEDED, const struct sha256 *h UNNEEDED, struct pubkey *next UNNEEDED) { fprintf(stderr, "blinding_next_pubkey called!\n"); abort(); } +/* Generated stub for daemon_conn_send */ +void daemon_conn_send(struct daemon_conn *dc UNNEEDED, const u8 *msg UNNEEDED) +{ fprintf(stderr, "daemon_conn_send called!\n"); abort(); } /* Generated stub for ecdh */ void ecdh(const struct pubkey *point UNNEEDED, struct secret *ss UNNEEDED) { fprintf(stderr, "ecdh called!\n"); abort(); } @@ -97,6 +100,9 @@ void status_fmt(enum log_level level UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "status_fmt called!\n"); abort(); } +/* Generated stub for towire_gossipd_got_local_channel_update */ +u8 *towire_gossipd_got_local_channel_update(const tal_t *ctx UNNEEDED, const struct short_channel_id *scid UNNEEDED, const u8 *channel_update UNNEEDED) +{ fprintf(stderr, "towire_gossipd_got_local_channel_update called!\n"); abort(); } /* Generated stub for towire_hsmd_cupdate_sig_req */ u8 *towire_hsmd_cupdate_sig_req(const tal_t *ctx UNNEEDED, const u8 *cu UNNEEDED) { fprintf(stderr, "towire_hsmd_cupdate_sig_req called!\n"); abort(); } diff --git a/gossipd/test/run-crc32_of_update.c b/gossipd/test/run-crc32_of_update.c index 3b7595f16..9c0fef29d 100644 --- a/gossipd/test/run-crc32_of_update.c +++ b/gossipd/test/run-crc32_of_update.c @@ -28,6 +28,9 @@ bool blinding_next_pubkey(const struct pubkey *pk UNNEEDED, const struct sha256 *h UNNEEDED, struct pubkey *next UNNEEDED) { fprintf(stderr, "blinding_next_pubkey called!\n"); abort(); } +/* Generated stub for daemon_conn_send */ +void daemon_conn_send(struct daemon_conn *dc UNNEEDED, const u8 *msg UNNEEDED) +{ fprintf(stderr, "daemon_conn_send called!\n"); abort(); } /* Generated stub for daemon_conn_wake */ void daemon_conn_wake(struct daemon_conn *dc UNNEEDED) { fprintf(stderr, "daemon_conn_wake called!\n"); abort(); } @@ -133,6 +136,9 @@ void status_fmt(enum log_level level UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "status_fmt called!\n"); abort(); } +/* Generated stub for towire_gossipd_got_local_channel_update */ +u8 *towire_gossipd_got_local_channel_update(const tal_t *ctx UNNEEDED, const struct short_channel_id *scid UNNEEDED, const u8 *channel_update UNNEEDED) +{ fprintf(stderr, "towire_gossipd_got_local_channel_update called!\n"); abort(); } /* Generated stub for towire_hsmd_cupdate_sig_req */ u8 *towire_hsmd_cupdate_sig_req(const tal_t *ctx UNNEEDED, const u8 *cu UNNEEDED) { fprintf(stderr, "towire_hsmd_cupdate_sig_req called!\n"); abort(); } diff --git a/tests/test_gossip.py b/tests/test_gossip.py index af6f9858d..c0210f7f2 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -1799,10 +1799,13 @@ def test_gossip_ratelimit(node_factory, bitcoind): canned gossip to the other partition consisting of l3. l3 should ratelimit the incoming gossip. + We get BROKEN logs because gossipd talks about non-existent channels to + lightningd ("**BROKEN** lightningd: Local update for bad scid 103x1x1"). """ l3, = node_factory.get_nodes( 1, - opts=[{'dev-gossip-time': 1568096251}] + opts=[{'dev-gossip-time': 1568096251, + 'allow_broken_log': True}] ) # Bump to block 102, so the following tx ends up in 103x1: @@ -1958,7 +1961,11 @@ def test_torport_onions(node_factory): @unittest.skipIf(not COMPAT, "needs COMPAT to convert obsolete gossip_store") def test_gossip_store_upgrade_v7_v8(node_factory): """Version 8 added feature bits to local channel announcements""" - l1 = node_factory.get_node(start=False) + + # We get BROKEN logs because gossipd talks about non-existent channels to + # lightningd ("**BROKEN** lightningd: Local update for bad scid 103x1x1"). + l1 = node_factory.get_node(start=False, + allow_broken_log=True) # A channel announcement with no channel_update. with open(os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, 'gossip_store'), 'wb') as f: diff --git a/tests/test_misc.py b/tests/test_misc.py index 3f13b1cad..8fb538c5a 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -1091,7 +1091,9 @@ def test_funding_reorg_private(node_factory, bitcoind): # Rescan to detect reorg at restart and may_reconnect so channeld # will restart. Reorg can cause bad gossip msg. opts = {'funding-confirms': 2, 'rescan': 10, 'may_reconnect': True, - 'allow_bad_gossip': True} + 'allow_bad_gossip': True, + # gossipd send lightning update for original channel. + 'allow_broken_log': True} l1, l2 = node_factory.line_graph(2, fundchannel=False, opts=opts) l1.fundwallet(10000000) sync_blockheight(bitcoind, [l1]) # height 102