Modernize codebase: C++17, remove Tor v2, add embedded Tor scaffold, IBD speedups

- Replace ~290 BOOST_FOREACH with C++11 range-for across 41+ files
- Replace boost::assign::map_list_of with C++11 brace initialization
- Remove PAIRTYPE macro (no longer needed without BOOST_FOREACH)
- Guard OpenSSL locking callbacks for 3.x (no-ops in >= 1.1.0)
- Fix Qt deprecated APIs for Qt6 compat (QStyleOptionViewItemV4, setResizeMode)
- Add openssl_compat.h version string wrapper
- Enable C++17 in makefile.unix and triangles-qt.pro

- Delete 163 dead Tor v2 source files (~150K lines removed)
- Add embedded Tor scaffold (tor_embedded.h/cpp) using tor_api.h
- Add build-libtor.sh helper and CODEX-TOR-GUIDE.md
- Update makefile.unix and .pro with USE_TOR_EMBEDDED optional flag
- Fallback to external tor_process when not compiled with libtor

- IBD pipeline refill: 100 -> 1000 blocks
- Send/recv buffer limits: unlimited -> 100MB/32MB
- Orphan block cap: unlimited -> 750 with random eviction
- Socket poll: 10ms -> 1ms during IBD
- Message handler sleep: 10ms -> 1ms during IBD
- Stall detection timeout: 5s -> 2s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-19 01:51:15 -07:00
parent 0beca5d801
commit 383a3b8b02
235 changed files with 1325 additions and 151064 deletions
+44
View File
@@ -0,0 +1,44 @@
// Local Tor embedding hooks used by the wallet.
// These are Triangles-specific helpers and intentionally live outside the
// vendored Tor source tree to make upstream rebases less painful.
#include "tor_embed_hooks.h"
#include "util.h"
#include <boost/filesystem.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
#include <memory>
#include <string>
const char* triangles_tor_data_directory()
{
static const std::string retrieved = (GetDataDir() / "tor").string();
return retrieved.c_str();
}
const char* triangles_onion_service_directory()
{
static const std::string retrieved = (GetDataDir() / "onion").string();
return retrieved.c_str();
}
int triangles_tor_check_interrupted()
{
return boost::this_thread::interruption_requested() ? 1 : 0;
}
static boost::mutex g_torInitializing;
static std::unique_ptr<boost::unique_lock<boost::mutex> > g_torUninitialized(
new boost::unique_lock<boost::mutex>(g_torInitializing));
void triangles_tor_set_initialized()
{
g_torUninitialized.reset();
}
void triangles_tor_wait_initialized()
{
boost::unique_lock<boost::mutex> checking(g_torInitializing);
}