Report rpc port in error when unable to connect
This commit is contained in:
@@ -28,9 +28,13 @@
|
||||
#include <event2/buffer.h>
|
||||
#include <event2/keyvalq_struct.h>
|
||||
#include "support/events.h"
|
||||
|
||||
uint16_t ASSETCHAINS_RPCPORT = 18031;
|
||||
uint16_t BITCOIND_RPCPORT = 18031;
|
||||
char SMART_CHAIN_SYMBOL[65];
|
||||
|
||||
extern uint16_t ASSETCHAINS_RPCPORT;
|
||||
|
||||
#include <univalue.h>
|
||||
|
||||
using namespace std;
|
||||
@@ -252,14 +256,16 @@ UniValue CallRPC(const std::string& strMethod, const UniValue& params)
|
||||
|
||||
event_base_dispatch(base.get());
|
||||
|
||||
if (response.status == 0)
|
||||
throw CConnectionFailed(strprintf("couldn't connect to server: %s (code %d)\n(make sure server is running and you are connecting to the correct RPC port)", http_errorstring(response.error), response.error));
|
||||
else if (response.status == HTTP_UNAUTHORIZED)
|
||||
if (response.status == 0) {
|
||||
throw CConnectionFailed(strprintf("couldn't connect to server at port %d : %s (code %d)\n(make sure server is running and you are connecting to the correct RPC port)",
|
||||
ASSETCHAINS_RPCPORT, http_errorstring(response.error), response.error));
|
||||
} else if (response.status == HTTP_UNAUTHORIZED) {
|
||||
throw std::runtime_error("incorrect rpcuser or rpcpassword (authorization failed)");
|
||||
else if (response.status >= 400 && response.status != HTTP_BAD_REQUEST && response.status != HTTP_NOT_FOUND && response.status != HTTP_INTERNAL_SERVER_ERROR)
|
||||
} else if (response.status >= 400 && response.status != HTTP_BAD_REQUEST && response.status != HTTP_NOT_FOUND && response.status != HTTP_INTERNAL_SERVER_ERROR) {
|
||||
throw std::runtime_error(strprintf("server returned HTTP error %d", response.status));
|
||||
else if (response.body.empty())
|
||||
throw std::runtime_error("no response from server");
|
||||
} else if (response.body.empty()) {
|
||||
throw std::runtime_error(strprintf("no response from server at port %d", ASSETCHAINS_RPCPORT ));
|
||||
}
|
||||
|
||||
// Parse reply
|
||||
UniValue valReply(UniValue::VSTR);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) 2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2016-2021 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -19,9 +19,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
#include "chainparamsbase.h"
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/**
|
||||
@@ -32,7 +30,7 @@ class CBaseMainParams : public CBaseChainParams
|
||||
public:
|
||||
CBaseMainParams()
|
||||
{
|
||||
nRPCPort = 7771;
|
||||
nRPCPort = 18031;
|
||||
}
|
||||
};
|
||||
static CBaseMainParams mainParams;
|
||||
@@ -45,7 +43,7 @@ class CBaseTestNetParams : public CBaseChainParams
|
||||
public:
|
||||
CBaseTestNetParams()
|
||||
{
|
||||
nRPCPort = 17771;
|
||||
nRPCPort = 28031;
|
||||
strDataDir = "testnet3";
|
||||
}
|
||||
};
|
||||
|
||||
@@ -568,7 +568,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-rpcbind=<addr>", _("Bind to given address to listen for JSON-RPC connections. Use [host]:port notation for IPv6. This option can be specified multiple times (default: bind to all interfaces)"));
|
||||
strUsage += HelpMessageOpt("-rpcuser=<user>", _("Username for JSON-RPC connections"));
|
||||
strUsage += HelpMessageOpt("-rpcpassword=<pw>", _("Password for JSON-RPC connections"));
|
||||
strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"), 7771, 17771));
|
||||
strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"), ASSETCHAINS_RPCPORT, 10000 + ASSETCHAINS_RPCPORT));
|
||||
strUsage += HelpMessageOpt("-rpcallowip=<ip>", _("Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"));
|
||||
strUsage += HelpMessageOpt("-rpcthreads=<n>", strprintf(_("Set the number of threads to service RPC calls (default: %d)"), DEFAULT_HTTP_THREADS));
|
||||
if (showDebug) {
|
||||
@@ -583,7 +583,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-metricsrefreshtime", strprintf(_("Number of seconds between metrics refreshes (default: %u if running in a console, %u otherwise)"), 1, 600));
|
||||
}
|
||||
strUsage += HelpMessageGroup(_("Hush Smart Chain options:"));
|
||||
strUsage += HelpMessageOpt("-ac_algo", _("Choose PoW mining algorithm, default is Equihash"));
|
||||
strUsage += HelpMessageOpt("-ac_algo", _("Choose PoW mining algorithm, default is Equihash (200,9)"));
|
||||
strUsage += HelpMessageOpt("-ac_blocktime", _("Block time in seconds, default is 60"));
|
||||
strUsage += HelpMessageOpt("-ac_cc", _("Cryptoconditions, default 0"));
|
||||
strUsage += HelpMessageOpt("-ac_beam", _("BEAM integration"));
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
|
||||
int64_t MAX_MONEY = 200000000 * 100000000LL;
|
||||
uint64_t ASSETCHAINS_SUPPLY;
|
||||
uint16_t BITCOIND_RPCPORT = 7771;
|
||||
uint16_t BITCOIND_RPCPORT = 18031;
|
||||
uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
|
||||
uint32_t ASSETCHAIN_INIT,ASSETCHAINS_CC;
|
||||
uint32_t ASSETCHAINS_MAGIC = 2387029918;
|
||||
|
||||
Reference in New Issue
Block a user