mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
tlv: Allow passing a raw pointer and a length to tlvstream_set_raw
Allows us to do fewer allocations, since the argument doesn't have to be tal allocated itself. Suggested-by: Rusty Russell <@rustyrussell>
This commit is contained in:
@@ -815,8 +815,10 @@ static void tlvstream_set_tlv_payload_data(struct tlv_field **stream,
|
||||
u8 *ser = tal_arr(NULL, u8, 0);
|
||||
towire_secret(&ser, payment_secret);
|
||||
towire_tu64(&ser, total_msat);
|
||||
tlvstream_set_raw(stream, TLV_TLV_PAYLOAD_PAYMENT_DATA, take(ser));
|
||||
tlvstream_set_raw(stream, TLV_TLV_PAYLOAD_PAYMENT_DATA, ser, tal_bytelen(ser));
|
||||
tal_free(ser);
|
||||
}
|
||||
|
||||
static void payment_add_hop_onion_payload(struct payment *p,
|
||||
struct createonion_hop *dst,
|
||||
struct route_hop *node,
|
||||
|
||||
Reference in New Issue
Block a user