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

@@ -351,13 +351,13 @@ static struct command_result *htlc_accepted_call(struct command *cmd,
return htlc_accepted_continue(cmd, NULL);
max = tal_bytelen(rawpayload);
payload = tlv_tlv_payload_new(cmd);
s = fromwire_bigsize(&rawpayload, &max);
if (s != max) {
return htlc_accepted_continue(cmd, NULL);
}
if (!fromwire_tlv_tlv_payload(&rawpayload, &max, payload)) {
payload = fromwire_tlv_tlv_payload(cmd, &rawpayload, &max);
if (!payload) {
plugin_log(
cmd->plugin, LOG_UNUSUAL, "Malformed TLV payload %.*s",
json_tok_full_len(params),