Skip to content

Commit

Permalink
lightingd: corrections from Alex Myers's review.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Jan 29, 2024
1 parent 1b97fe1 commit bcf551a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lightningd/channel_gossip.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ const u8 *channel_gossip_update_for_error(const tal_t *ctx,
* - MUST set the `short_channel_id` to either an `alias` it has
* received from the peer, or the real channel `short_channel_id`.
*/
/* But we used to get this wrong! Sot this is the only place where we
/* But we used to get this wrong! So this is the only place where we
* look up by *remote* id. It's not unique, but it is unique for a
* specific peer. */
static struct channel *lookup_by_peer_remote_alias(struct lightningd *ld,
Expand Down
2 changes: 1 addition & 1 deletion lightningd/channel_gossip.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void channel_gossip_channel_reestablished(struct channel *channel);
/* Peer has disconnected */
void channel_gossip_channel_disconnect(struct channel *channel);

/* Gossipd sent us this channel_update about the peer's side of the channle */
/* Gossipd sent us this channel_update about the peer's side of the channel */
void channel_gossip_set_remote_update(struct lightningd *ld,
const struct peer_update *update TAKES,
const struct node_id *source);
Expand Down
6 changes: 5 additions & 1 deletion lightningd/gossip_generation.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ u8 *unsigned_channel_update(const tal_t *ctx,

/* Make sure timestamp changes! */
timestamp = time_now().ts.tv_sec;
/* FIXME: @endothermicdev points out that our clock could be
* wrong once, and now we'll keep producing future timestamps.
* We could sanity check that old_timestamp is within 2 weeks and
* discard? */
if (old_timestamp && timestamp <= *old_timestamp)
timestamp = *old_timestamp + 1;

Expand Down Expand Up @@ -347,7 +351,7 @@ static const struct wireaddr *gather_addresses(const tal_t *ctx,
{
struct wireaddr *addrs;

/* Note: If no announceable, tal_dup_talarr returns NULL! */
/* Note: If ld->announceable is NULL, tal_dup_talarr returns NULL! */
addrs = tal_dup_talarr(ctx, struct wireaddr, ld->announceable);
if (!addrs)
addrs = tal_arr(ctx, struct wireaddr, 0);
Expand Down
10 changes: 5 additions & 5 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_remote_addr(node_factory, bitcoind):

def_port = default_ln_port(l2.info["network"])

# when we restart l1 with a channel and reconnect, node_annoucement update
# when we restart l1 with a channel and reconnect, node_announcement update
# must not yet be send as we need the same `remote_addr` confirmed from a
# another peer we have a channel with.
# Note: In this state l2 stores remote_addr as reported by l1
Expand All @@ -125,7 +125,7 @@ def test_remote_addr(node_factory, bitcoind):
assert not l2.daemon.is_in_log("Update our node_announcement for discovered address: 127.0.0.1:{}".format(def_port))
assert len(l2.rpc.getinfo()['address']) == 0

# connect second node. This will trigger `node_annoucement` update.
# connect second node. This will trigger `node_announcement` update.
l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
l2.daemon.wait_for_log("Peer says it sees our address as: 127.0.0.1:[0-9]{5}")
l2.daemon.wait_for_log("Update our node_announcement for discovered address: 127.0.0.1:{}".format(def_port))
Expand All @@ -146,7 +146,7 @@ def test_remote_addr(node_factory, bitcoind):


def test_remote_addr_disabled(node_factory, bitcoind):
"""Simply tests that IP address discovery annoucements can be turned off
"""Simply tests that IP address discovery announcements can be turned off
We perform logic tests on L2, setup:
l1 --> [l2] <-- l3
Expand Down Expand Up @@ -179,7 +179,7 @@ def test_remote_addr_disabled(node_factory, bitcoind):
l2.daemon.wait_for_log(f"{l3.info['id']}.*Already have funding locked in")

# if ip discovery would have been enabled, we would have send an updated
# node_annoucement by now. Check we didn't...
# node_announcement by now. Check we didn't...
bitcoind.generate_block(6) # ugly, but we need to wait for gossip...
assert not l2.daemon.is_in_log("Update our node_announcement for discovered address")

Expand Down Expand Up @@ -225,7 +225,7 @@ def test_remote_addr_port(node_factory, bitcoind):
l2.rpc.connect(l3.info['id'], 'localhost', l3.port)

# if ip discovery would have been enabled, we would have send an updated
# node_annoucement by now. Check we didn't...
# node_announcement by now. Check we didn't...
l2.daemon.wait_for_logs(["Already have funding locked in",
"Update our node_announcement for discovered address"])
info = l2.rpc.getinfo()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_announce_dns_suppressed(node_factory, bitcoind):


def test_announce_and_connect_via_dns(node_factory, bitcoind):
""" Test that DNS annoucements propagate and can be used when connecting.
""" Test that DNS announcements propagate and can be used when connecting.
- First node announces only a FQDN like 'localhost.localdomain'.
- Second node gets a channel with first node.
Expand Down

0 comments on commit bcf551a

Please sign in to comment.