From 1682b1922a68a5930720afabc2b9f1e9f509fae7 Mon Sep 17 00:00:00 2001 From: goatpig Date: Thu, 15 Nov 2018 18:38:00 +0100 Subject: [PATCH] added satoshi-port command line argument --- cppForSwig/BlockDataManagerConfig.cpp | 21 ++++++++++++++++++--- cppForSwig/BlockDataManagerConfig.h | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/cppForSwig/BlockDataManagerConfig.cpp b/cppForSwig/BlockDataManagerConfig.cpp index 3b8966a76..0c1e93565 100644 --- a/cppForSwig/BlockDataManagerConfig.cpp +++ b/cppForSwig/BlockDataManagerConfig.cpp @@ -99,7 +99,6 @@ void BlockDataManagerConfig::selectNetwork(const string &netname) genesisBlockHash_ = READHEX(MAINNET_GENESIS_HASH_HEX); genesisTxHash_ = READHEX(MAINNET_GENESIS_TX_HASH_HEX); magicBytes_ = READHEX(MAINNET_MAGIC_BYTES); - btcPort_ = portToString(NODE_PORT_MAINNET); rpcPort_ = portToString(RPC_PORT_MAINNET); pubkeyHashPrefix_ = SCRIPT_PREFIX_HASH160; scriptHashPrefix_ = SCRIPT_PREFIX_P2SH; @@ -107,13 +106,15 @@ void BlockDataManagerConfig::selectNetwork(const string &netname) if (!customFcgiPort_) fcgiPort_ = portToString(FCGI_PORT_MAINNET); + + if(!customBtcPort_) + btcPort_ = portToString(NODE_PORT_MAINNET); } else if (netname == "Test") { genesisBlockHash_ = READHEX(TESTNET_GENESIS_HASH_HEX); genesisTxHash_ = READHEX(TESTNET_GENESIS_TX_HASH_HEX); magicBytes_ = READHEX(TESTNET_MAGIC_BYTES); - btcPort_ = portToString(NODE_PORT_TESTNET); rpcPort_ = portToString(RPC_PORT_TESTNET); pubkeyHashPrefix_ = SCRIPT_PREFIX_HASH160_TESTNET; scriptHashPrefix_ = SCRIPT_PREFIX_P2SH_TESTNET; @@ -123,13 +124,15 @@ void BlockDataManagerConfig::selectNetwork(const string &netname) if (!customFcgiPort_) fcgiPort_ = portToString(FCGI_PORT_TESTNET); + + if (!customBtcPort_) + btcPort_ = portToString(NODE_PORT_MAINNET); } else if (netname == "Regtest") { genesisBlockHash_ = READHEX(REGTEST_GENESIS_HASH_HEX); genesisTxHash_ = READHEX(REGTEST_GENESIS_TX_HASH_HEX); magicBytes_ = READHEX(REGTEST_MAGIC_BYTES); - btcPort_ = portToString(NODE_PORT_REGTEST); rpcPort_ = portToString(RPC_PORT_TESTNET); pubkeyHashPrefix_ = SCRIPT_PREFIX_HASH160_TESTNET; scriptHashPrefix_ = SCRIPT_PREFIX_P2SH_TESTNET; @@ -139,6 +142,9 @@ void BlockDataManagerConfig::selectNetwork(const string &netname) if (!customFcgiPort_) fcgiPort_ = portToString(FCGI_PORT_REGTEST); + + if (!customBtcPort_) + btcPort_ = portToString(NODE_PORT_MAINNET); } } @@ -226,6 +232,8 @@ void BlockDataManagerConfig::parseArgs(int argc, char* argv[]) --listen-all: listen to all incoming IPs (not just localhost) + --satoshi-port: set Bitcoin node port + ***/ try @@ -409,6 +417,13 @@ void BlockDataManagerConfig::processArgs(const map& args, listen_all_ = true; } + iter = args.find("satoshi-port"); + if (iter != args.end()) + { + btcPort_ = stripQuotes(iter->second); + customBtcPort_ = true; + } + //network type iter = args.find("testnet"); if (iter != args.end()) diff --git a/cppForSwig/BlockDataManagerConfig.h b/cppForSwig/BlockDataManagerConfig.h index e4395813e..b95e1c662 100644 --- a/cppForSwig/BlockDataManagerConfig.h +++ b/cppForSwig/BlockDataManagerConfig.h @@ -63,6 +63,7 @@ struct BlockDataManagerConfig string rpcPort_; bool customFcgiPort_ = false; + bool customBtcPort_ = false; unsigned ramUsage_ = 50;