tools/generate_wire.py: make functions allocate the TLV.

Requiring the caller to allocate them is ugly, and differs from
other types.

This means we need a context arg if we don't have one already.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-03-23 10:01:14 +10:30
parent 2b422272e5
commit a770f51d0e
32 changed files with 199 additions and 199 deletions

View File

@@ -47,7 +47,7 @@ static struct io_plan *peer_init_received(struct io_conn *conn,
{
u8 *msg = cryptomsg_decrypt_body(tmpctx, &peer->cs, peer->msg);
u8 *globalfeatures, *features;
struct tlv_init_tlvs *tlvs = tlv_init_tlvs_new(msg);
struct tlv_init_tlvs *tlvs;
struct wireaddr *remote_addr;
if (!msg)
@@ -64,7 +64,7 @@ static struct io_plan *peer_init_received(struct io_conn *conn,
if (unlikely(is_unknown_msg_discardable(msg)))
return read_init(conn, peer);
if (!fromwire_init(tmpctx, msg, &globalfeatures, &features, tlvs)) {
if (!fromwire_init(tmpctx, msg, &globalfeatures, &features, &tlvs)) {
status_peer_debug(&peer->id,
"bad fromwire_init '%s', closing",
tal_hex(tmpctx, msg));