From 0aea5d7fbe28ace6a0fa1f0ccb57c1d12dcf251d Mon Sep 17 00:00:00 2001 From: jfreegman Date: Thu, 22 Sep 2022 13:51:00 -0400 Subject: [PATCH] Remove testnet specific code Preparing for ngc merge --- script/build-minimal-static-toxic.sh | 15 +++++--- src/bootstrap.c | 51 +--------------------------- 2 files changed, 11 insertions(+), 55 deletions(-) diff --git a/script/build-minimal-static-toxic.sh b/script/build-minimal-static-toxic.sh index ad5f779..f6fd60b 100755 --- a/script/build-minimal-static-toxic.sh +++ b/script/build-minimal-static-toxic.sh @@ -136,15 +136,20 @@ mkdir -p "$BUILD_DIR" cd "$BUILD_DIR" # The git hash of the c-toxcore version we're using -TOXCORE_VERSION="02996f06850fb565fa5520cb4e1daa8c616b41c1" +TOXCORE_VERSION="v0.2.16" + +# The sha256sum of the c-toxcore tarball for TOXCORE_VERSION +TOXCORE_HASH="653aa42654b607f0940cecfac873e9ce55605119a90d1dc454d1090ff6ca29c0" TOXCORE_FILENAME="toxcore-$TOXCORE_VERSION.tar.gz" -wget --timeout=10 -O "$TOXCORE_FILENAME" "https://github.com/JFreegman/toxcore/archive/$TOXCORE_VERSION.tar.gz" +wget --timeout=10 -O "$TOXCORE_FILENAME" "https://github.com/TokTok/c-toxcore/archive/$TOXCORE_VERSION.tar.gz" +check_sha256 "$TOXCORE_HASH" "$TOXCORE_FILENAME" + tar -o -xf "$TOXCORE_FILENAME" rm "$TOXCORE_FILENAME" -cd toxcore* +cd c-toxcore* mkdir -p "third_party" && cd "third_party" CMP_VERSION="074e0df43e8a61ea938c4f77f65d1fbccc0c3bf9" @@ -152,11 +157,11 @@ CMP_FILENAME="cmp-$CMP_VERSION.tar.gz" wget --timeout=10 -O "$CMP_FILENAME" "https://github.com/TokTok/cmp/archive/$CMP_VERSION.tar.gz" tar -o -xf "$CMP_FILENAME" -mv cmp\-*/* "cmp/" +mkdir cmp && mv cmp\-*/* "cmp/" cd .. cmake -B_build -H. \ - -DUSE_TEST_NETWORK=ON \ + -DUSE_TEST_NETWORK=OFF \ -DENABLE_STATIC=ON \ -DENABLE_SHARED=OFF \ -DCMAKE_BUILD_TYPE=Release \ diff --git a/src/bootstrap.c b/src/bootstrap.c index d37e4d1..f54783b 100644 --- a/src/bootstrap.c +++ b/src/bootstrap.c @@ -42,7 +42,7 @@ extern struct user_settings *user_settings; /* URL that we get the JSON encoded nodes list from. */ -#define NODES_LIST_URL 0 // This should be empty until NGC merges with mainnet +#define NODES_LIST_URL "https://nodes.tox.chat/json" #define DEFAULT_NODES_FILENAME "DHTnodes.json" @@ -79,29 +79,6 @@ extern struct user_settings *user_settings; /* Maximum allowable size of the nodes list */ #define MAX_NODELIST_SIZE (MAX_RECV_CURL_DATA_SIZE) -// TODO(Jfreegman): Remove this before production -static uint8_t const TESTNET_KEY[] = { - 0x79, 0xCA, 0xDA, 0x49, 0x74, 0xB0, 0x92, 0x6F, - 0x28, 0x6F, 0x02, 0x5C, 0xD5, 0xFF, 0xDF, 0x3E, - 0x65, 0x4A, 0x37, 0x58, 0xC5, 0x3E, 0x02, 0x73, - 0xEC, 0xFC, 0x4D, 0x12, 0xC2, 0x1D, 0xCA, 0x48, -}; - -// TODO(Jfreegman): Remove this before production -#define TESTNET_PORT 33445 - -#define TESTNET_IP "172.93.52.70" - -static uint8_t const TESTNET_KEY2[] = { - 0x5E, 0x47, 0xBA, 0x1D, 0xC3, 0x91, 0x3E, 0xB2, - 0xCB, 0xF2, 0xD6, 0x4C, 0xE4, 0xF2, 0x3D, 0x8B, - 0xFE, 0x53, 0x91, 0xBF, 0xAB, 0xE5, 0xC4, 0x3C, - 0x5B, 0xAD, 0x13, 0xF0, 0xA4, 0x14, 0xCD, 0x77, -}; - -#define TESTNET_PORT2 38445 -#define TESTNET_IP2 "tox.plastiras.org" - static struct Thread_Data { pthread_t tid; pthread_attr_t attr; @@ -298,11 +275,6 @@ on_exit: */ static int update_DHT_nodeslist(const char *nodes_path) { - if (NODES_LIST_URL == 0) { // TODO: Remove this when NGC merges with mainnet - fprintf(stderr, "Skipping DHT Nodes list fetching (remove before production)\n"); - return 0; - } - if (!nodeslist_needs_update(nodes_path)) { return 0; } @@ -583,25 +555,6 @@ on_exit: */ int load_DHT_nodeslist(void) { - // TODO(Jfreegman): Remove this before production - fprintf(stderr, "Adding NGC testnet node - remove this before production\n"); - - struct Node *node = &Nodes.list[0]; - node->have_ip4 = true; - node->port = TESTNET_PORT; - memcpy(node->key, TESTNET_KEY, sizeof(TESTNET_KEY)); - memcpy(node->ip4, TESTNET_IP, sizeof(TESTNET_IP)); - - struct Node *node2 = &Nodes.list[1]; - node2->have_ip4 = true; - node2->port = TESTNET_PORT2; - memcpy(node2->key, TESTNET_KEY2, sizeof(TESTNET_KEY2)); - memcpy(node2->ip4, TESTNET_IP2, sizeof(TESTNET_IP2)); - - Nodes.count = 2; - -#if 0 - if (thread_data.active) { return -1; } @@ -625,8 +578,6 @@ int load_DHT_nodeslist(void) return -5; } -#endif - return 0; }