gossipd: don't close non-local channels immediately, add 12 block delay.

This adds a new "chan_dying" message to the gossip_store, but since we
already changed the minor version in this PR, we don't bump it again.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Protocol: We now delay forgetting funding-spent channels for 12 blocks (as per latest BOLTs, to support splicing in future).
This commit is contained in:
Rusty Russell
2022-09-14 13:20:32 +09:30
parent f0fa42bd73
commit a1f62ba0e7
12 changed files with 204 additions and 35 deletions

View File

@@ -68,6 +68,7 @@ int main(int argc, char *argv[])
u32 msglen = be32_to_cpu(hdr.len);
u8 *msg, *inner;
bool deleted, push, ratelimit;
u32 blockheight;
deleted = (msglen & GOSSIP_STORE_LEN_DELETED_BIT);
push = (msglen & GOSSIP_STORE_LEN_PUSH_BIT);
@@ -121,6 +122,11 @@ int main(int argc, char *argv[])
printf("delete channel: %s\n",
type_to_string(tmpctx, struct short_channel_id,
&scid));
} else if (fromwire_gossip_store_chan_dying(msg, &scid, &blockheight)) {
printf("dying channel: %s (deadline %u)\n",
type_to_string(tmpctx, struct short_channel_id,
&scid),
blockheight);
} else {
warnx("Unknown message %u",
fromwire_peektype(msg));