common: generalize extract_channel_id().

connectd is going to end up using this do demux; make it fast and complete.

Fixing this reveals a problem in openingd: it now extracts the channel_id
from funding_signed (which is where we transition off the temporary), and
gets upset.  So fix that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-12-28 09:54:09 +10:30
parent 5111f39d2a
commit 35e3c1866e
26 changed files with 264 additions and 60 deletions

View File

@@ -88,10 +88,10 @@ void towire_channel_id(u8 **pptr, const struct channel_id *channel_id)
towire(pptr, channel_id, sizeof(*channel_id));
}
void fromwire_channel_id(const u8 **cursor, size_t *max,
bool fromwire_channel_id(const u8 **cursor, size_t *max,
struct channel_id *channel_id)
{
fromwire(cursor, max, channel_id, sizeof(*channel_id));
return fromwire(cursor, max, channel_id, sizeof(*channel_id)) != NULL;
}
REGISTER_TYPE_TO_HEXSTR(channel_id);