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

Function test_block_range

gossipd/test/run-next_block_range.c:61–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59/* AUTOGENERATED MOCKS END */
60
61static void test_block_range(struct seeker *seeker,
62 u32 blockheight,
63 u32 first, u32 last,
64 ...)
65{
66 int start, end, num;
67 u32 first_blocknum, number_of_blocks;
68 va_list ap;
69
70 seeker->daemon->current_blockheight = blockheight;
71 seeker->scid_probe_start = first;
72 seeker->scid_probe_end = last;
73
74 num = last - first + 1;
75 va_start(ap, last);
76 while ((start = va_arg(ap, int)) != -1) {
77 end = va_arg(ap, int);
78 if (!next_block_range(seeker, num,
79 &first_blocknum, &number_of_blocks))
80 abort();
81 if (first_blocknum != start
82 || number_of_blocks != end - start + 1) {
83 errx(1, "Expected %u-%u but got %u-%u",
84 start, end,
85 first_blocknum, first_blocknum+number_of_blocks-1);
86 }
87 num = end - start + 1;
88 }
89 if (next_block_range(seeker, num, &first_blocknum, &number_of_blocks))
90 abort();
91 va_end(ap);
92}
93
94int main(int argc, char *argv[])
95{

Callers 1

mainFunction · 0.85

Calls 3

next_block_rangeFunction · 0.85
abortFunction · 0.85
errxFunction · 0.85

Tested by

no test coverage detected