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:
@@ -432,7 +432,7 @@ bool CTxDB::LoadBlockIndex()
|
||||
// Calculate nChainTrust
|
||||
vector<pair<int, CBlockIndex*> > vSortedByHeight;
|
||||
vSortedByHeight.reserve(mapBlockIndex.size());
|
||||
BOOST_FOREACH(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex)
|
||||
for (const auto& item : mapBlockIndex)
|
||||
{
|
||||
CBlockIndex* pindex = item.second;
|
||||
vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex));
|
||||
@@ -443,7 +443,7 @@ bool CTxDB::LoadBlockIndex()
|
||||
int nProgressInterval = std::max((int)vSortedByHeight.size() / 20, 1);
|
||||
int nCount = 0;
|
||||
|
||||
BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight)
|
||||
for (const auto& item : vSortedByHeight)
|
||||
{
|
||||
CBlockIndex* pindex = item.second;
|
||||
pindex->nChainTrust = (pindex->pprev ? pindex->pprev->nChainTrust : 0) + pindex->GetBlockTrust();
|
||||
@@ -530,7 +530,7 @@ bool CTxDB::LoadBlockIndex()
|
||||
{
|
||||
pair<unsigned int, unsigned int> pos = make_pair(pindex->nFile, pindex->nBlockPos);
|
||||
mapBlockPos[pos] = pindex;
|
||||
BOOST_FOREACH(const CTransaction &tx, block.vtx)
|
||||
for (const CTransaction &tx : block.vtx)
|
||||
{
|
||||
uint256 hashTx = tx.GetHash();
|
||||
CTxIndex txindex;
|
||||
@@ -557,7 +557,7 @@ bool CTxDB::LoadBlockIndex()
|
||||
unsigned int nOutput = 0;
|
||||
if (nCheckLevel>3)
|
||||
{
|
||||
BOOST_FOREACH(const CDiskTxPos &txpos, txindex.vSpent)
|
||||
for (const CDiskTxPos &txpos : txindex.vSpent)
|
||||
{
|
||||
if (!txpos.IsNull())
|
||||
{
|
||||
@@ -584,7 +584,7 @@ bool CTxDB::LoadBlockIndex()
|
||||
else
|
||||
{
|
||||
bool fFound = false;
|
||||
BOOST_FOREACH(const CTxIn &txin, txSpend.vin)
|
||||
for (const CTxIn &txin : txSpend.vin)
|
||||
if (txin.prevout.hash == hashTx && txin.prevout.n == nOutput)
|
||||
fFound = true;
|
||||
if (!fFound)
|
||||
@@ -602,7 +602,7 @@ bool CTxDB::LoadBlockIndex()
|
||||
// check level 5: check whether all prevouts are marked spent
|
||||
if (nCheckLevel>4)
|
||||
{
|
||||
BOOST_FOREACH(const CTxIn &txin, tx.vin)
|
||||
for (const CTxIn &txin : tx.vin)
|
||||
{
|
||||
CTxIndex txindex;
|
||||
if (ReadTxIndex(txin.prevout.hash, txindex))
|
||||
|
||||
Reference in New Issue
Block a user