From 77cf47f9610b758fa38421b2ebf750f77a8cab9c Mon Sep 17 00:00:00 2001 From: edtubbs Date: Mon, 4 Nov 2024 13:58:32 -0600 Subject: [PATCH 1/2] ci: updated runner to macos-13 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0fd0e444..f39380e22 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: goal: install - name: x86_64-macos host: x86_64-apple-darwin15 - os: macos-12 + os: macos-13 run-tests: true dep-opts: "SPEED=slow V=1" config-opts: "--enable-static --disable-shared --enable-test-passwd" From 5aa6405aedacd25919c64551b739d4112d741723 Mon Sep 17 00:00:00 2001 From: edtubbs Date: Thu, 16 Jan 2025 11:15:39 -0600 Subject: [PATCH 2/2] chainparams: added backup dns seed net: updated to query all seeds tests: updated net test to query all seeds --- src/chainparams.c | 2 +- src/net.c | 38 +++++++++++++++++++++++--------------- test/net_tests.c | 23 ++++++++++++++++------- 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/src/chainparams.c b/src/chainparams.c index 8eaa73dd1..fa208b01e 100644 --- a/src/chainparams.c +++ b/src/chainparams.c @@ -41,7 +41,7 @@ const dogecoin_chainparams dogecoin_chainparams_main = { {0x91, 0x56, 0x35, 0x2c, 0x18, 0x18, 0xb3, 0x2e, 0x90, 0xc9, 0xe7, 0x92, 0xef, 0xd6, 0xa1, 0x1a, 0x82, 0xfe, 0x79, 0x56, 0xa6, 0x30, 0xf0, 0x3b, 0xbe, 0xe2, 0x36, 0xce, 0xda, 0xe3, 0x91, 0x1a}, {0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 22556, - {{"seed.multidoge.org"}, {{1}}}, + {{"seed.multidoge.org"}, {{"seed2.multidoge.org"}}}, true, 0x0062, {0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, // pow limit diff --git a/src/net.c b/src/net.c index 4076fcf7a..2e73221ef 100644 --- a/src/net.c +++ b/src/net.c @@ -833,21 +833,29 @@ dogecoin_bool dogecoin_node_group_add_peers_by_ip_or_seed(dogecoin_node_group *g if (ips == NULL) { /* === DNS QUERY === */ vector* ips_dns = vector_new(10, free); - const dogecoin_dns_seed seed = group->chainparams->dnsseeds[0]; - if (strlen(seed.domain) == 0) { - return false; - } - /* todo: make sure we have enough peers, eventually */ - dogecoin_get_peers_from_dns(seed.domain, ips_dns, group->chainparams->default_port, AF_INET); - unsigned int i; - for (i = 0; i < ips_dns->len; i++) { - char* ip = (char*)vector_idx(ips_dns, i); - - /* create a node */ - dogecoin_node* node = dogecoin_node_new(); - if (dogecoin_node_set_ipport(node, ip) > 0) { - /* add the node to the group */ - dogecoin_node_group_add_node(group, node); + unsigned int seed_index; + /* dogecoin_chainparams has up to 8 dns seeds */ + for (seed_index = 0; seed_index < 8; seed_index++) { + const dogecoin_dns_seed seed = group->chainparams->dnsseeds[seed_index]; + if (strlen(seed.domain) == 0) { + continue; + } + /* todo: make sure we have enough peers, eventually */ + dogecoin_get_peers_from_dns(seed.domain, ips_dns, group->chainparams->default_port, AF_INET); + unsigned int i; + for (i = 0; i < ips_dns->len; i++) { + char* ip = (char*)vector_idx(ips_dns, i); + + /* create a node */ + dogecoin_node* node = dogecoin_node_new(); + if (dogecoin_node_set_ipport(node, ip) > 0) { + /* add the node to the group */ + dogecoin_node_group_add_node(group, node); + } + } + /* exit if we get peers from a seed */ + if (ips_dns->len > 0) { + break; } } vector_free(ips_dns, true); diff --git a/test/net_tests.c b/test/net_tests.c index e07b581b7..e743403b7 100644 --- a/test/net_tests.c +++ b/test/net_tests.c @@ -198,13 +198,22 @@ void test_net_basics_plus_download_block() { vector *ips = vector_new(10, free); - const dogecoin_dns_seed seed = dogecoin_chainparams_test.dnsseeds[0]; - - dogecoin_get_peers_from_dns(seed.domain, ips, dogecoin_chainparams_test.default_port, AF_INET); - unsigned int i; - for (i = 0; i < ips->len; i++) - { - debug_print("dns seed ip %d: %s\n", i, (char *)vector_idx(ips, i)); + unsigned int seed_index; + /* dogecoin_chainparams has up to 8 dns seeds */ + for (seed_index = 0; seed_index < 8; seed_index++) { + const dogecoin_dns_seed seed = dogecoin_chainparams_test.dnsseeds[seed_index]; + if (strlen(seed.domain) == 0) { + continue; + } + dogecoin_get_peers_from_dns(seed.domain, ips, dogecoin_chainparams_test.default_port, AF_INET); + unsigned int i; + for (i = 0; i < ips->len; i++) { + debug_print("dns seed ip %d: %s\n", i, (char *)vector_idx(ips, i)); + } + /* exit if we get peers from a seed */ + if (ips->len > 0) { + break; + } } vector_free(ips, true);