Files
triangles_v5/src/net_bootstrap.h
T
sami7777 4563e7952b
Build All Platforms / build-linux-qt (push) Failing after 3h0m3s
Build All Platforms / test-linux-unit (push) Failing after 3h0m4s
Build All Platforms / build-linux-daemon (push) Failing after 21s
Build All Platforms / build-windows-qt (push) Has been cancelled
Build All Platforms / build-windows-daemon (push) Has been cancelled
Build All Platforms / build-macos (push) Has been cancelled
Build All Platforms / release (push) Has been cancelled
Add dynamic HTTP seed discovery, remove hardcoded seeds (v5.5.0)
Replace all hardcoded seed addresses (onion, clearnet, DNS) with a
dynamic HTTP-based seed list fetched from seeds.cryptographic-triangles.org
on startup. New getseedlist RPC exposes known .onion peers from the
address manager for a collector script to publish.

Any wallet that comes online with an onion address is automatically
discovered by peers via P2P addr exchange and appears in the seed list
within minutes. No binary rebuilds needed when addresses change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 18:25:43 -07:00

90 lines
3.2 KiB
C++

// Copyright (c) 2024 Triangles developers
// Network Bootstrap Configuration for Triangles v5.0.0.0
// Distributed under the MIT/X11 software license
#ifndef TRIANGLES_NET_BOOTSTRAP_H
#define TRIANGLES_NET_BOOTSTRAP_H
#include <cstdint>
#include <string>
#include <vector>
// Network bootstrap configuration for preserving old wallets
// while enabling modern Tor v3 functionality
namespace NetBootstrap {
// DNS seed nodes for initial bootstrap (clearnet fallback)
// Unused attribute prevents warnings
static const char* strDNSSeed[] __attribute__((unused)) = {
"seed1.cryptographic-triangles.org",
"seed2.cryptographic-triangles.org",
"seed3.cryptographic-triangles.org",
"backup-seed.cryptographic-triangles.org",
NULL
};
// Hardcoded seeds removed - peer discovery is now fully dynamic via HTTP seed list.
// See: seeds.cryptographic-triangles.org
static const unsigned int pnSeed[] __attribute__((unused)) = {
};
// Network protocol compatibility settings
struct NetworkConfig {
// Preserve compatibility with old wallets
static const int MIN_PROTOCOL_VERSION_OLD_WALLET = 70200;
static const int CURRENT_PROTOCOL_VERSION = 70205;
// Network ports (preserved from existing configuration)
static const int DEFAULT_PORT_MAINNET = 24112;
static const int DEFAULT_PORT_TESTNET = 24111;
static const int DEFAULT_RPC_PORT_MAINNET = 19112;
static const int DEFAULT_RPC_PORT_TESTNET = 19111;
// Connection limits for different node types
static const int MAX_CONNECTIONS_DEFAULT = 125;
static const int MAX_CONNECTIONS_TOR_ONLY = 64;
static const int MAX_OUTBOUND_CONNECTIONS = 8;
// Tor-specific configuration
static const int TOR_HIDDEN_SERVICE_PORT = 24112;
static constexpr const char* TOR_PROXY_DEFAULT = "127.0.0.1:9050";
// Network timeouts and retry settings
static const int CONNECTION_TIMEOUT_SECONDS = 30;
static const int PEER_DISCOVERY_INTERVAL_SECONDS = 3600; // 1 hour
static const int SEEDER_ANNOUNCEMENT_INTERVAL_SECONDS = 1800; // 30 minutes
};
// Bootstrap sequence for different wallet types
enum BootstrapMode {
BOOTSTRAP_LEGACY, // Old wallets without Tor
BOOTSTRAP_TOR_MIXED, // Mixed clearnet + Tor
BOOTSTRAP_TOR_ONLY // Tor-only mode
};
// Get bootstrap configuration based on wallet capabilities
BootstrapMode GetBootstrapMode();
// Initialize network bootstrap based on configuration
bool InitializeNetworkBootstrap(BootstrapMode mode);
// Backward compatibility helpers
bool IsOldWalletCompatible(int protocolVersion);
std::vector<std::string> GetCompatibleSeedNodes(int protocolVersion);
// Network health monitoring
struct NetworkHealth {
int connectedPeers;
int torPeers;
int clearnetPeers;
bool isBootstrapped;
bool isSyncing;
int64_t lastBlockTime;
};
NetworkHealth GetNetworkHealth();
} // namespace NetBootstrap
#endif // TRIANGLES_NET_BOOTSTRAP_H