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:
+18
-22
@@ -3,8 +3,6 @@
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <boost/assign/list_of.hpp>
|
||||
|
||||
#include "base58.h"
|
||||
#include "trianglesrpc.h"
|
||||
#include "txdb.h"
|
||||
@@ -15,7 +13,6 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
using namespace boost::assign;
|
||||
using namespace json_spirit;
|
||||
|
||||
void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeHex)
|
||||
@@ -39,7 +36,7 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeH
|
||||
out.push_back(Pair("type", GetTxnOutputType(type)));
|
||||
|
||||
Array a;
|
||||
BOOST_FOREACH(const CTxDestination& addr, addresses)
|
||||
for (const CTxDestination& addr : addresses)
|
||||
a.push_back(CTrianglesAddress(addr).ToString());
|
||||
out.push_back(Pair("addresses", a));
|
||||
}
|
||||
@@ -51,7 +48,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
|
||||
entry.push_back(Pair("time", (boost::int64_t)tx.nTime));
|
||||
entry.push_back(Pair("locktime", (boost::int64_t)tx.nLockTime));
|
||||
Array vin;
|
||||
BOOST_FOREACH(const CTxIn& txin, tx.vin)
|
||||
for (const CTxIn& txin : tx.vin)
|
||||
{
|
||||
Object in;
|
||||
if (tx.IsCoinBase())
|
||||
@@ -162,7 +159,7 @@ Value listunspent(const Array& params, bool fHelp)
|
||||
if (params.size() > 2)
|
||||
{
|
||||
Array inputs = params[2].get_array();
|
||||
BOOST_FOREACH(Value& input, inputs)
|
||||
for (Value& input : inputs)
|
||||
{
|
||||
CTrianglesAddress address(input.get_str());
|
||||
if (!address.IsValid())
|
||||
@@ -176,7 +173,7 @@ Value listunspent(const Array& params, bool fHelp)
|
||||
Array results;
|
||||
vector<COutput> vecOutputs;
|
||||
pwalletMain->AvailableCoins(vecOutputs, false);
|
||||
BOOST_FOREACH(const COutput& out, vecOutputs)
|
||||
for (const COutput& out : vecOutputs)
|
||||
{
|
||||
if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth)
|
||||
continue;
|
||||
@@ -231,7 +228,7 @@ Value createrawtransaction(const Array& params, bool fHelp)
|
||||
|
||||
CTransaction rawTx;
|
||||
|
||||
BOOST_FOREACH(Value& input, inputs)
|
||||
for (Value& input : inputs)
|
||||
{
|
||||
const Object& o = input.get_obj();
|
||||
|
||||
@@ -254,7 +251,7 @@ Value createrawtransaction(const Array& params, bool fHelp)
|
||||
}
|
||||
|
||||
set<CTrianglesAddress> setAddress;
|
||||
BOOST_FOREACH(const Pair& s, sendTo)
|
||||
for (const Pair& s : sendTo)
|
||||
{
|
||||
CTrianglesAddress address(s.name_);
|
||||
if (!address.IsValid())
|
||||
@@ -382,7 +379,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
|
||||
tempTx.FetchInputs(txdb, unused, false, false, mapPrevTx, fInvalid);
|
||||
|
||||
// Copy results into mapPrevOut:
|
||||
BOOST_FOREACH(const CTxIn& txin, tempTx.vin)
|
||||
for (const CTxIn& txin : tempTx.vin)
|
||||
{
|
||||
const uint256& prevHash = txin.prevout.hash;
|
||||
if (mapPrevTx.count(prevHash) && mapPrevTx[prevHash].second.vout.size()>txin.prevout.n)
|
||||
@@ -394,7 +391,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
|
||||
if (params.size() > 1 && params[1].type() != null_type)
|
||||
{
|
||||
Array prevTxs = params[1].get_array();
|
||||
BOOST_FOREACH(Value& p, prevTxs)
|
||||
for (Value& p : prevTxs)
|
||||
{
|
||||
if (p.type() != obj_type)
|
||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "expected object with {\"txid'\",\"vout\",\"scriptPubKey\"}");
|
||||
@@ -442,7 +439,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
|
||||
{
|
||||
fGivenKeys = true;
|
||||
Array keys = params[2].get_array();
|
||||
BOOST_FOREACH(Value k, keys)
|
||||
for (Value k : keys)
|
||||
{
|
||||
CTrianglesSecret vchSecret;
|
||||
bool fGood = vchSecret.SetString(k.get_str());
|
||||
@@ -463,15 +460,14 @@ Value signrawtransaction(const Array& params, bool fHelp)
|
||||
int nHashType = SIGHASH_ALL;
|
||||
if (params.size() > 3 && params[3].type() != null_type)
|
||||
{
|
||||
static map<string, int> mapSigHashValues =
|
||||
boost::assign::map_list_of
|
||||
(string("ALL"), int(SIGHASH_ALL))
|
||||
(string("ALL|ANYONECANPAY"), int(SIGHASH_ALL|SIGHASH_ANYONECANPAY))
|
||||
(string("NONE"), int(SIGHASH_NONE))
|
||||
(string("NONE|ANYONECANPAY"), int(SIGHASH_NONE|SIGHASH_ANYONECANPAY))
|
||||
(string("SINGLE"), int(SIGHASH_SINGLE))
|
||||
(string("SINGLE|ANYONECANPAY"), int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY))
|
||||
;
|
||||
static map<string, int> mapSigHashValues = {
|
||||
{"ALL", int(SIGHASH_ALL)},
|
||||
{"ALL|ANYONECANPAY", int(SIGHASH_ALL|SIGHASH_ANYONECANPAY)},
|
||||
{"NONE", int(SIGHASH_NONE)},
|
||||
{"NONE|ANYONECANPAY", int(SIGHASH_NONE|SIGHASH_ANYONECANPAY)},
|
||||
{"SINGLE", int(SIGHASH_SINGLE)},
|
||||
{"SINGLE|ANYONECANPAY", int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY)},
|
||||
};
|
||||
string strHashType = params[3].get_str();
|
||||
if (mapSigHashValues.count(strHashType))
|
||||
nHashType = mapSigHashValues[strHashType];
|
||||
@@ -498,7 +494,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
|
||||
SignSignature(keystore, prevPubKey, mergedTx, i, nHashType);
|
||||
|
||||
// ... and merge in other signatures:
|
||||
BOOST_FOREACH(const CTransaction& txv, txVariants)
|
||||
for (const CTransaction& txv : txVariants)
|
||||
{
|
||||
txin.scriptSig = CombineSignatures(prevPubKey, mergedTx, i, txin.scriptSig, txv.vin[i].scriptSig);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user