Skip to content

Commit

Permalink
added satoshi-port command line argument
Browse files Browse the repository at this point in the history
  • Loading branch information
goatpig committed Nov 15, 2018
1 parent 46f0c59 commit 1682b19
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
21 changes: 18 additions & 3 deletions cppForSwig/BlockDataManagerConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,22 @@ 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;
bech32Prefix_ = "bc";

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;
Expand All @@ -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;
Expand All @@ -139,6 +142,9 @@ void BlockDataManagerConfig::selectNetwork(const string &netname)

if (!customFcgiPort_)
fcgiPort_ = portToString(FCGI_PORT_REGTEST);

if (!customBtcPort_)
btcPort_ = portToString(NODE_PORT_MAINNET);
}
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -409,6 +417,13 @@ void BlockDataManagerConfig::processArgs(const map<string, string>& 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())
Expand Down
1 change: 1 addition & 0 deletions cppForSwig/BlockDataManagerConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct BlockDataManagerConfig
string rpcPort_;

bool customFcgiPort_ = false;
bool customBtcPort_ = false;


unsigned ramUsage_ = 50;
Expand Down

0 comments on commit 1682b19

Please sign in to comment.