From 6dd1dacb9cd52ac71848184f14415a6b37ef8868 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 8 Apr 2019 09:26:29 +0930 Subject: [PATCH] devtools/create-gossipstore: add --max option to create reduced testsets. eg. for running under valgrind. Signed-off-by: Rusty Russell --- devtools/create-gossipstore.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/devtools/create-gossipstore.c b/devtools/create-gossipstore.c index c2072f849..f6861e570 100644 --- a/devtools/create-gossipstore.c +++ b/devtools/create-gossipstore.c @@ -42,6 +42,7 @@ int main(int argc, char *argv[]) int infd, outfd; FILE * scidfd; struct scidsat * scids; + unsigned max = -1U; setup_locale(); @@ -55,6 +56,8 @@ int main(int argc, char *argv[]) "Input for 'scid, satshis' csv"); opt_register_arg("--sat", opt_set_charp, NULL, &csat, "default satoshi value if --scidfile flag not present"); + opt_register_arg("--max", opt_set_uintval, opt_show_uintval, &max, + "maximum number of messages to read"); opt_register_noarg("--help|-h", opt_usage_and_exit, "Create gossip store, from be16 / input messages", "Print this message."); @@ -144,6 +147,8 @@ int main(int argc, char *argv[]) exit(1); } tal_free(inmsg); + if (--max == 0) + break; } fprintf(stderr, "channels %d, updates %d, nodes %d\n", channels, updates, nodes); if (scidfile)