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

Function test_block_range

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

Source from the content-addressed store, hash-verified

83/* AUTOGENERATED MOCKS END */
84
85static void test_block_range(struct seeker *seeker,
86 u32 blockheight,
87 u32 first, u32 last,
88 ...)
89{
90 int start, end, num;
91 u32 first_blocknum, number_of_blocks;
92 va_list ap;
93
94 seeker->daemon->current_blockheight = blockheight;
95 seeker->scid_probe_start = first;
96 seeker->scid_probe_end = last;
97
98 num = last - first + 1;
99 va_start(ap, last);
100 while ((start = va_arg(ap, int)) != -1) {
101 end = va_arg(ap, int);
102 if (!next_block_range(seeker, num,
103 &first_blocknum, &number_of_blocks))
104 abort();
105 if (first_blocknum != start
106 || number_of_blocks != end - start + 1) {
107 errx(1, "Expected %u-%u but got %u-%u",
108 start, end,
109 first_blocknum, first_blocknum+number_of_blocks-1);
110 }
111 num = end - start + 1;
112 }
113 if (next_block_range(seeker, num, &first_blocknum, &number_of_blocks))
114 abort();
115 va_end(ap);
116}
117
118int main(int argc, char *argv[])
119{

Callers 1

mainFunction · 0.85

Calls 3

next_block_rangeFunction · 0.85
abortFunction · 0.85
errxFunction · 0.85

Tested by

no test coverage detected