-
Notifications
You must be signed in to change notification settings - Fork 902
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
Offers preparation #3685
Conversation
rustyrussell
commented
May 1, 2020
- Some tooling improvements.
- Add missing "channel_announce" features to listchannels.
For bolt 13, we have no message types, just a TLV. Signed-off-by: Rusty Russell <[email protected]>
…in spec-generated files. We need this for bolt13. Signed-off-by: Rusty Russell <[email protected]>
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 <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
This msg is stored in the gossip_store, so it means a version bump. Signed-off-by: Rusty Russell <[email protected]>
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 <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
…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 <[email protected]>
Signed-off-by: Rusty Russell <[email protected]> Changelog-Added: JSON API: `listchannels` now shows channel `features`.
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; | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.