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

Function prepend_length

lightningd/peer_htlcs.c:1044–1055  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1042}
1043
1044static u8 *prepend_length(const tal_t *ctx, const u8 *payload TAKES)
1045{
1046 u8 buf[BIGSIZE_MAX_LEN], *ret;
1047 size_t len;
1048
1049 len = bigsize_put(buf, tal_bytelen(payload));
1050 ret = tal_arr(ctx, u8, len + tal_bytelen(payload));
1051 memcpy(ret, buf, len);
1052 memcpy(ret + len, payload, tal_bytelen(payload));
1053 tal_free_if_taken(payload);
1054 return ret;
1055}
1056
1057/**
1058 * 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