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

Function prepend_length

lightningd/peer_htlcs.c:1000–1011  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

998}
999
1000static u8 *prepend_length(const tal_t *ctx, const u8 *payload TAKES)
1001{
1002 u8 buf[BIGSIZE_MAX_LEN], *ret;
1003 size_t len;
1004
1005 len = bigsize_put(buf, tal_bytelen(payload));
1006 ret = tal_arr(ctx, u8, len + tal_bytelen(payload));
1007 memcpy(ret, buf, len);
1008 memcpy(ret + len, payload, tal_bytelen(payload));
1009 tal_free_if_taken(payload);
1010 return ret;
1011}
1012
1013/**
1014 * Callback when a plugin answers to the htlc_accepted hook

Callers 1

Calls 3

tal_bytelenFunction · 0.85
tal_free_if_takenFunction · 0.85
bigsize_putFunction · 0.50

Tested by

no test coverage detected