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

Function pull

bitcoin/block.c:11–29  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

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