mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
gossipd: feed lightningd the channel_updates as soon as we make them.
Even if we're deferring putting them in the store and broadcasting them, we tell lightningd so it will use it in any error messages. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
51d23ffcd3
commit
430a380e35
5 changed files with 31 additions and 3 deletions
|
@ -3,6 +3,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <ccan/cast/cast.h>
|
#include <ccan/cast/cast.h>
|
||||||
#include <ccan/mem/mem.h>
|
#include <ccan/mem/mem.h>
|
||||||
|
#include <common/daemon_conn.h>
|
||||||
#include <common/features.h>
|
#include <common/features.h>
|
||||||
#include <common/memleak.h>
|
#include <common/memleak.h>
|
||||||
#include <common/status.h>
|
#include <common/status.h>
|
||||||
|
@ -15,6 +16,7 @@
|
||||||
#include <gossipd/gossip_store_wiregen.h>
|
#include <gossipd/gossip_store_wiregen.h>
|
||||||
#include <gossipd/gossipd.h>
|
#include <gossipd/gossipd.h>
|
||||||
#include <gossipd/gossipd_peerd_wiregen.h>
|
#include <gossipd/gossipd_peerd_wiregen.h>
|
||||||
|
#include <gossipd/gossipd_wiregen.h>
|
||||||
#include <hsmd/hsmd_wiregen.h>
|
#include <hsmd/hsmd_wiregen.h>
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
|
|
||||||
|
@ -418,6 +420,11 @@ static u8 *sign_and_timestamp_update(const tal_t *ctx,
|
||||||
if (taken(unsigned_update))
|
if (taken(unsigned_update))
|
||||||
tal_free(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;
|
return update;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@ bool blinding_next_pubkey(const struct pubkey *pk UNNEEDED,
|
||||||
const struct sha256 *h UNNEEDED,
|
const struct sha256 *h UNNEEDED,
|
||||||
struct pubkey *next UNNEEDED)
|
struct pubkey *next UNNEEDED)
|
||||||
{ fprintf(stderr, "blinding_next_pubkey called!\n"); abort(); }
|
{ 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 */
|
/* Generated stub for ecdh */
|
||||||
void ecdh(const struct pubkey *point UNNEEDED, struct secret *ss UNNEEDED)
|
void ecdh(const struct pubkey *point UNNEEDED, struct secret *ss UNNEEDED)
|
||||||
{ fprintf(stderr, "ecdh called!\n"); abort(); }
|
{ fprintf(stderr, "ecdh called!\n"); abort(); }
|
||||||
|
@ -97,6 +100,9 @@ void status_fmt(enum log_level level UNNEEDED,
|
||||||
const char *fmt UNNEEDED, ...)
|
const char *fmt UNNEEDED, ...)
|
||||||
|
|
||||||
{ fprintf(stderr, "status_fmt called!\n"); abort(); }
|
{ 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 */
|
/* Generated stub for towire_hsmd_cupdate_sig_req */
|
||||||
u8 *towire_hsmd_cupdate_sig_req(const tal_t *ctx UNNEEDED, const u8 *cu UNNEEDED)
|
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(); }
|
{ fprintf(stderr, "towire_hsmd_cupdate_sig_req called!\n"); abort(); }
|
||||||
|
|
|
@ -28,6 +28,9 @@ bool blinding_next_pubkey(const struct pubkey *pk UNNEEDED,
|
||||||
const struct sha256 *h UNNEEDED,
|
const struct sha256 *h UNNEEDED,
|
||||||
struct pubkey *next UNNEEDED)
|
struct pubkey *next UNNEEDED)
|
||||||
{ fprintf(stderr, "blinding_next_pubkey called!\n"); abort(); }
|
{ 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 */
|
/* Generated stub for daemon_conn_wake */
|
||||||
void daemon_conn_wake(struct daemon_conn *dc UNNEEDED)
|
void daemon_conn_wake(struct daemon_conn *dc UNNEEDED)
|
||||||
{ fprintf(stderr, "daemon_conn_wake called!\n"); abort(); }
|
{ fprintf(stderr, "daemon_conn_wake called!\n"); abort(); }
|
||||||
|
@ -133,6 +136,9 @@ void status_fmt(enum log_level level UNNEEDED,
|
||||||
const char *fmt UNNEEDED, ...)
|
const char *fmt UNNEEDED, ...)
|
||||||
|
|
||||||
{ fprintf(stderr, "status_fmt called!\n"); abort(); }
|
{ 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 */
|
/* Generated stub for towire_hsmd_cupdate_sig_req */
|
||||||
u8 *towire_hsmd_cupdate_sig_req(const tal_t *ctx UNNEEDED, const u8 *cu UNNEEDED)
|
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(); }
|
{ fprintf(stderr, "towire_hsmd_cupdate_sig_req called!\n"); abort(); }
|
||||||
|
|
|
@ -1799,10 +1799,13 @@ def test_gossip_ratelimit(node_factory, bitcoind):
|
||||||
canned gossip to the other partition consisting of l3. l3 should ratelimit
|
canned gossip to the other partition consisting of l3. l3 should ratelimit
|
||||||
the incoming gossip.
|
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(
|
l3, = node_factory.get_nodes(
|
||||||
1,
|
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:
|
# 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")
|
@unittest.skipIf(not COMPAT, "needs COMPAT to convert obsolete gossip_store")
|
||||||
def test_gossip_store_upgrade_v7_v8(node_factory):
|
def test_gossip_store_upgrade_v7_v8(node_factory):
|
||||||
"""Version 8 added feature bits to local channel announcements"""
|
"""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.
|
# A channel announcement with no channel_update.
|
||||||
with open(os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, 'gossip_store'), 'wb') as f:
|
with open(os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, 'gossip_store'), 'wb') as f:
|
||||||
|
|
|
@ -1091,7 +1091,9 @@ def test_funding_reorg_private(node_factory, bitcoind):
|
||||||
# Rescan to detect reorg at restart and may_reconnect so channeld
|
# Rescan to detect reorg at restart and may_reconnect so channeld
|
||||||
# will restart. Reorg can cause bad gossip msg.
|
# will restart. Reorg can cause bad gossip msg.
|
||||||
opts = {'funding-confirms': 2, 'rescan': 10, 'may_reconnect': True,
|
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, l2 = node_factory.line_graph(2, fundchannel=False, opts=opts)
|
||||||
l1.fundwallet(10000000)
|
l1.fundwallet(10000000)
|
||||||
sync_blockheight(bitcoind, [l1]) # height 102
|
sync_blockheight(bitcoind, [l1]) # height 102
|
||||||
|
|
Loading…
Add table
Reference in a new issue