| 268 | } |
| 269 | |
| 270 | int main(int argc, char *argv[]) |
| 271 | { |
| 272 | struct io_conn *conn = tal(NULL, struct io_conn); |
| 273 | struct wireaddr_internal addr; |
| 274 | int af = -1; |
| 275 | struct pubkey us, them; |
| 276 | const char *err_msg; |
| 277 | const char *at; |
| 278 | struct addrinfo *ai = NULL; |
| 279 | |
| 280 | setup_locale(); |
| 281 | secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | |
| 282 | SECP256K1_CONTEXT_SIGN); |
| 283 | |
| 284 | memset(¬sosecret, 0x42, sizeof(notsosecret)); |
| 285 | features = tal_arr(conn, u8, 0); |
| 286 | chainparams = chainparams_for_network("bitcoin"); |
| 287 | |
| 288 | opt_register_noarg("--initial-sync", opt_set_bool, &initial_sync, |
| 289 | "Stream complete gossip history at start"); |
| 290 | opt_register_arg("--max-messages", opt_set_ulongval, opt_show_ulongval, |
| 291 | &max_messages, |
| 292 | "Terminate after reading this many messages"); |
| 293 | opt_register_noarg("--stdin", opt_set_bool, &stream_stdin, |
| 294 | "Stream gossip messages from stdin."); |
| 295 | opt_register_noarg("--no-init", opt_set_bool, &no_init, |
| 296 | "Don't send or swallow init messages."); |
| 297 | opt_register_arg("--privkey", opt_set_secret, opt_show_secret, |
| 298 | ¬sosecret, |
| 299 | "Secret key to use for our identity"); |
| 300 | opt_register_arg("--timeout-after", opt_set_intval, opt_show_intval, |
| 301 | &timeout_after, |
| 302 | "Exit (success) this many seconds after no msgs rcvd"); |
| 303 | opt_register_noarg("--hex", opt_set_bool, &hex, |
| 304 | "Print out messages in hex"); |
| 305 | opt_register_arg("--features=<hex>", opt_set_features, NULL, |
| 306 | &features, "Send these features in init"); |
| 307 | opt_register_arg("--network", opt_set_network, opt_show_network, |
| 308 | NULL, |
| 309 | "Select the network parameters (bitcoin, testnet, signet," |
| 310 | " regtest, liquid, liquid-regtest, litecoin or" |
| 311 | " litecoin-testnet)"); |
| 312 | opt_register_noarg("--help|-h", opt_usage_and_exit, |
| 313 | "id@addr[:port] [hex-msg-tosend...]\n" |
| 314 | "Connect to a lightning peer and relay gossip messages from it", |
| 315 | "Print this message."); |
| 316 | |
| 317 | opt_parse(&argc, argv, opt_log_stderr_exit); |
| 318 | if (argc < 2) |
| 319 | opt_usage_exit_fail("Need an id@addr to connect to"); |
| 320 | at = strchr(argv[1], '@'); |
| 321 | if (!at) |
| 322 | opt_usage_exit_fail("Need id@addr"); |
| 323 | |
| 324 | if (!pubkey_from_hexstr(argv[1], at - argv[1], &them)) |
| 325 | opt_usage_exit_fail("Invalid id %.*s", |
| 326 | (int)(at - argv[1]), argv[1]); |
| 327 |
nothing calls this directly
no test coverage detected