MCPcopy Create free account
hub / github.com/ElementsProject/lightning / prepend_length

Function prepend_length

lightningd/peer_htlcs.c:881–893  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

879}
880
881static u8 *prepend_length(const tal_t *ctx, const u8 *payload TAKES)
882{
883 u8 buf[BIGSIZE_MAX_LEN], *ret;
884 size_t len;
885
886 len = bigsize_put(buf, tal_bytelen(payload));
887 ret = tal_arr(ctx, u8, len + tal_bytelen(payload));
888 memcpy(ret, buf, len);
889 memcpy(ret + len, payload, tal_bytelen(payload));
890 if (taken(payload))
891 tal_free(payload);
892 return ret;
893}
894
895/**
896 * Callback when a plugin answers to the htlc_accepted hook

Callers 1

Calls 4

tal_bytelenFunction · 0.85
takenFunction · 0.85
tal_freeFunction · 0.85
bigsize_putFunction · 0.50

Tested by

no test coverage detected