| 334 | } |
| 335 | |
| 336 | int main(int argc, char *argv[]) |
| 337 | { |
| 338 | struct io_conn *conn = tal(NULL, struct io_conn); |
| 339 | struct wireaddr_internal addr; |
| 340 | int af = -1; |
| 341 | struct pubkey us, them; |
| 342 | const char *err_msg; |
| 343 | const char *at; |
| 344 | struct addrinfo *ai = NULL; |
| 345 | |
| 346 | setup_locale(); |
| 347 | secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | |
| 348 | SECP256K1_CONTEXT_SIGN); |
| 349 | |
| 350 | memset(¬sosecret, 0x42, sizeof(notsosecret)); |
| 351 | features = tal_arr(conn, u8, 0); |
| 352 | chainparams = chainparams_for_network("bitcoin"); |
| 353 | |
| 354 | opt_register_noarg("--all-gossip", opt_set_bool, &all_gossip, |
| 355 | "Stream complete gossip history at start"); |
| 356 | opt_register_noarg("--handle-pings", opt_set_bool, &handle_pings, |
| 357 | "Reply to pings"); |
| 358 | opt_register_noarg("--no-gossip", opt_set_bool, &no_gossip, |
| 359 | "Suppress all gossip at start"); |
| 360 | opt_register_arg("--filter", opt_set_filter, NULL, &accept_messages, |
| 361 | "Only process these message types"); |
| 362 | opt_register_arg("--max-messages", opt_set_ulongval, opt_show_ulongval, |
| 363 | &max_messages, |
| 364 | "Terminate after reading this many messages"); |
| 365 | opt_register_noarg("--stdin", opt_set_bool, &stream_stdin, |
| 366 | "Stream gossip messages from stdin."); |
| 367 | opt_register_noarg("--no-init", opt_set_bool, &no_init, |
| 368 | "Don't send or swallow init messages."); |
| 369 | opt_register_arg("--privkey", opt_set_secret, opt_show_secret, |
| 370 | ¬sosecret, |
| 371 | "Secret key to use for our identity"); |
| 372 | opt_register_arg("--timeout-after", opt_set_intval, opt_show_intval, |
| 373 | &timeout_after, |
| 374 | "Exit (success) this many seconds after no msgs rcvd"); |
| 375 | opt_register_noarg("--hex", opt_set_bool, &hex, |
| 376 | "Print out messages in hex"); |
| 377 | opt_register_arg("--features=<hex>", opt_set_features, NULL, |
| 378 | &features, "Send these features in init"); |
| 379 | opt_register_arg("--network", opt_set_network, opt_show_network, |
| 380 | NULL, |
| 381 | "Select the network parameters (bitcoin, testnet, signet," |
| 382 | " regtest, liquid, or liquid-regtest)"); |
| 383 | opt_register_noarg("--must-get-max-messages", opt_set_bool, &no_early_close, |
| 384 | "Fail with exit code 1 unless we reach maximum messages"); |
| 385 | opt_register_noarg("--help|-h", opt_usage_and_exit, |
| 386 | "id@addr[:port] [hex-msg-tosend...]\n" |
| 387 | "Connect to a lightning peer and relay gossip messages from it", |
| 388 | "Print this message."); |
| 389 | |
| 390 | opt_parse(&argc, argv, opt_log_stderr_exit); |
| 391 | if (argc < 2) |
| 392 | opt_usage_exit_fail("Need an id@addr to connect to"); |
| 393 | at = strchr(argv[1], '@'); |
nothing calls this directly
no test coverage detected