Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offers preparation #3685

Merged
merged 9 commits into from
May 6, 2020
Merged

Conversation

rustyrussell
Copy link
Contributor

  1. Some tooling improvements.
  2. Add missing "channel_announce" features to listchannels.

@rustyrussell rustyrussell requested a review from cdecker as a code owner May 1, 2020 07:11
@rustyrussell rustyrussell marked this pull request as draft May 1, 2020 07:11
For bolt 13, we have no message types, just a TLV.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…in spec-generated files.

We need this for bolt13.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The formatting makes it harder for update-mocks, eg:

    /* Generated stub for fmt_wireaddr_without_port */
    char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED)
    { fprintf(stderr, "fmt_wireaddr_without_port called!\n"); abort(); }
    /* Could not find declaration for fromwire_onionmsg_path */
    /* Generated stub for json_add_member */

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This msg is stored in the gossip_store, so it means a version bump.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The previous patch changed the gossip_store, but in a trivial way.
The next patch will implement upgrading, so this is the test.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…ouncement.

This saves us keeping it in memory (so far, no channels have features), but
lets us optimize that case so we don't need to hit the disk for most of the
channels in listchannels.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON API: `listchannels` now shows channel `features`.
@rustyrussell rustyrussell marked this pull request as ready for review May 4, 2020 00:20
Comment on lines +126 to +136
static bool upgrade_field(u8 oldversion, u8 **msg)
{
assert(can_upgrade(oldversion));

/* We only need to upgrade this */
if (fromwire_peektype(*msg) == WIRE_GOSSIPD_LOCAL_ADD_CHANNEL) {
/* Append two 0 bytes, for (empty) feature bits */
tal_resizez(msg, tal_bytelen(*msg) + 2);
}
return true;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patching these on the fly seems a bit strange to me: couldn't we have optional fields at the end, maybe even make the switch to TLV encode the local_add_channel instead? That'd allow us to add/remove optional fields without bumping the gossip_store version later. It'd be better future proofing imho.

Copy link
Contributor Author

@rustyrussell rustyrussell May 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, these (internal) messages are unusual: usually we don't need to worry about compatibility at all. I only did this because it was easy: I don't want all the callers to have to worry about missing fields.

I'm not committing to preserving the gossip_store in future revs!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, BTW, these are patched during our "offline compaction" run which always runs at startup and rewrites the files.

So they're not converted every time!

Copy link
Collaborator

@niftynei niftynei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK fc11b90

Closes #3678

@rustyrussell rustyrussell merged commit 046b402 into ElementsProject:master May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants