| 219 | } |
| 220 | |
| 221 | int main(int argc, char *argv[]) |
| 222 | { |
| 223 | struct privkey node_privkey[2], funding_privkey[2]; |
| 224 | struct pubkey node[2], bitcoin[2]; |
| 225 | struct node_id nodeid[2]; |
| 226 | int lesser_key; |
| 227 | struct short_channel_id scid; |
| 228 | struct bitcoin_blkid chainhash; |
| 229 | secp256k1_ecdsa_signature nodesig[2], bitcoinsig[2]; |
| 230 | const u8 *features; |
| 231 | u8 *cannounce; |
| 232 | /* 2 bytes msg type + 256 bytes of signatures */ |
| 233 | const size_t channel_announcement_offset = 2 + 256; |
| 234 | int argnum; |
| 235 | struct sha256_double hash; |
| 236 | struct update_opts opts[2]; |
| 237 | |
| 238 | setup_locale(); |
| 239 | |
| 240 | secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | |
| 241 | SECP256K1_CONTEXT_SIGN); |
| 242 | |
| 243 | if (argc < 8 + 7 * 2) |
| 244 | errx(1, "Usage: mkgossip <scid> <chainhash> <node-privkey1> <node-privkey2> <node1-funding-privkey> <node2-funding-privkey> <features-hex> update-opts-1 update-opts-2\n" |
| 245 | "Where <update-opts> is:\n" |
| 246 | " <timestamp>\n" |
| 247 | " <cltv_expiry_delta>\n" |
| 248 | " <htlc_minimum_msat>\n" |
| 249 | " <fee_base_msat>\n" |
| 250 | " <fee_proportional_millionths>\n" |
| 251 | " <htlc_maximum_msat-or-empty>\n" |
| 252 | " <hex-addrstr>"); |
| 253 | |
| 254 | opt_register_noarg("-v|--verbose", opt_set_bool, &verbose, |
| 255 | "Increase verbosity"); |
| 256 | |
| 257 | opt_parse(&argc, argv, opt_log_stderr_exit); |
| 258 | |
| 259 | argnum = 1; |
| 260 | if (!short_channel_id_from_str(argv[argnum], strlen(argv[argnum]), &scid)) |
| 261 | errx(1, "Bad scid"); |
| 262 | argnum++; |
| 263 | /* Don't do endian-reversing insanity here! */ |
| 264 | if (!hex_decode(argv[argnum], strlen(argv[argnum]), |
| 265 | &chainhash, sizeof(chainhash))) |
| 266 | errx(1, "Parsing chainhash"); |
| 267 | argnum++; |
| 268 | if (!hex_decode(argv[argnum], strlen(argv[argnum]), |
| 269 | &node_privkey[0], sizeof(node_privkey[0]))) |
| 270 | errx(1, "Parsing node-privkey1"); |
| 271 | argnum++; |
| 272 | if (!hex_decode(argv[argnum], strlen(argv[argnum]), |
| 273 | &node_privkey[1], sizeof(node_privkey[2]))) |
| 274 | errx(1, "Parsing node-privkey2"); |
| 275 | argnum++; |
| 276 | if (!hex_decode(argv[argnum], strlen(argv[argnum]), |
| 277 | &funding_privkey[0], sizeof(funding_privkey[0]))) |
| 278 | errx(1, "Parsing funding-privkey1"); |
nothing calls this directly
no test coverage detected