mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
plugins: simplify htlc_accepted hook payload-setting API.
As discussed with Christian, prepending the length to the payload returned is awkward, but it's the only way to set a legacy payload. As this will be soon deprecated, simplify the external API. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -18,17 +18,13 @@ static struct command_result *
|
||||
htlc_accepted_continue(struct command *cmd, struct tlv_tlv_payload *payload)
|
||||
{
|
||||
struct json_stream *response;
|
||||
u8 *binpayload, *rawpayload;
|
||||
response = jsonrpc_stream_success(cmd);
|
||||
|
||||
json_add_string(response, "result", "continue");
|
||||
if (payload) {
|
||||
binpayload = tal_arr(cmd, u8, 0);
|
||||
u8 *binpayload = tal_arr(cmd, u8, 0);
|
||||
towire_tlvstream_raw(&binpayload, payload->fields);
|
||||
rawpayload = tal_arr(cmd, u8, 0);
|
||||
towire_bigsize(&rawpayload, tal_bytelen(binpayload));
|
||||
towire(&rawpayload, binpayload, tal_bytelen(binpayload));
|
||||
json_add_string(response, "payload", tal_hex(cmd, rawpayload));
|
||||
json_add_string(response, "payload", tal_hex(cmd, binpayload));
|
||||
}
|
||||
return command_finished(cmd, response);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user