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

Function pull

bitcoin/block.c:10–28  ·  view source on GitHub ↗

Sets *cursor to NULL and returns NULL when a pull fails. */

Source from the content-addressed store, hash-verified

8
9/* Sets *cursor to NULL and returns NULL when a pull fails. */
10static const u8 *pull(const u8 **cursor, size_t *max, void *copy, size_t n)
11{
12 const u8 *p = *cursor;
13
14 if (*max < n) {
15 *cursor = NULL;
16 *max = 0;
17 /* Just make sure we don't leak uninitialized mem! */
18 if (copy)
19 memset(copy, 0, n);
20 return NULL;
21 }
22 *cursor += n;
23 *max -= n;
24 assert(p);
25 if (copy)
26 memcpy(copy, p, n);
27 return memcheck(p, n);
28}
29
30static u32 pull_le32(const u8 **cursor, size_t *max)
31{

Callers 5

pull_le32Function · 0.85
pull_varintFunction · 0.85
bitcoin_block_from_hexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected