]> Git Repo - VerusCoin.git/commitdiff
Ensure correct connectivity params
authormiketout <[email protected]>
Thu, 18 Apr 2019 22:50:28 +0000 (15:50 -0700)
committermiketout <[email protected]>
Thu, 18 Apr 2019 22:50:28 +0000 (15:50 -0700)
src/komodo_globals.h
src/komodo_utils.h
src/miner.cpp
src/pbaas/crosschainrpc.cpp

index 2c289fb68bc319932ad132ed71881ec1d6a18eba..6f5a05cbe72a54ad0ff983a311adaec52b114fa7 100644 (file)
@@ -50,12 +50,13 @@ std::string VERUS_CHEATCATCHER, NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_O
 uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE;
 bool VERUS_MINTBLOCKS;
 
-char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096];
+char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN], ASSETCHAINS_USERPASS[4096];
 
 bool PBAAS_TESTMODE;
 std::string PBAAS_HOST;
 int32_t PBAAS_PORT;
 std::string PBAAS_USERPASS;
+std::string ASSETCHAINS_RPCHOST, ASSETCHAINS_RPCCREDENTIALS;
 
 uint160 ASSETCHAINS_CHAINID;
 uint160 VERUS_CHAINID;
index 10c686f53696c32467325e536f9af55fb1930299..fea882f4ab8b055286c52accbb9c99c824bf3398 100644 (file)
@@ -1943,6 +1943,8 @@ void komodo_args(char *argv0)
 
             PBAAS_STARTBLOCK = GetArg("-startblock", 0);
             PBAAS_ENDBLOCK = GetArg("-endblock", 0);
+
+            ASSETCHAINS_RPCHOST = GetArg("-rpchost", "127.0.0.1");
         }
 
         MAX_BLOCK_SIGOPS = 60000;
@@ -2042,12 +2044,14 @@ void komodo_args(char *argv0)
         {
             int32_t komodo_baseid(char *origbase);
             extern int COINBASE_MATURITY;
-            if ( (port= komodo_userpass(ASSETCHAINS_USERPASS,ASSETCHAINS_SYMBOL)) != 0 )
+            if ( (port= komodo_userpass(ASSETCHAINS_USERPASS, ASSETCHAINS_SYMBOL)) != 0 )
                 ASSETCHAINS_RPCPORT = port;
             else komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT + 1);
             if (ASSETCHAINS_LASTERA == 0 && ASSETCHAINS_REWARD[0] == 0)
                 COINBASE_MATURITY = 1;
             //fprintf(stderr,"ASSETCHAINS_RPCPORT (%s) %u\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_RPCPORT);
+            ASSETCHAINS_RPCCREDENTIALS = string(ASSETCHAINS_USERPASS);
+            ASSETCHAINS_RPCHOST = GetArg("-rpchost", "127.0.0.1");
         }
         if ( ASSETCHAINS_RPCPORT == 0 )
             ASSETCHAINS_RPCPORT = ASSETCHAINS_P2PPORT + 1;
@@ -2095,6 +2099,16 @@ void komodo_args(char *argv0)
             }
             obj.push_back(Pair("eras", eras));
 
+            /* We need to store node information here
+            UniValue nodes(UniValue::VARR);
+            {
+                UniValue node(UniValue::VOBJ);
+                node.push_back(Pair("networkaddress", ));
+                node.push_back(Pair("paymentaddress", ));
+            }
+            obj.push_back(Pair("nodes", nodes));
+            */
+
             SetThisChain(obj);
             paramsLoaded = true;
         }
index 68230c9753b301d81203650066b3488db98d73a0..d2c1fe7930aea085a22e8d7b528bbc49e8aaa259 100644 (file)
@@ -131,8 +131,9 @@ extern uint160 ASSETCHAINS_CHAINID;
 extern uint160 VERUS_CHAINID;
 extern std::string VERUS_CHAINNAME;
 extern int32_t PBAAS_STARTBLOCK, PBAAS_ENDBLOCK;
-extern string PBAAS_HOST, PBAAS_USERPASS;
+extern string PBAAS_HOST, PBAAS_USERPASS, ASSETCHAINS_RPCHOST, ASSETCHAINS_RPCCREDENTIALS;;
 extern int32_t PBAAS_PORT;
+extern uint16_t ASSETCHAINS_RPCPORT;
 extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY;
 void vcalc_sha256(char deprecated[(256 >> 3) * 2 + 1],uint8_t hash[256 >> 3],uint8_t *src,int32_t len);
 
@@ -1615,20 +1616,23 @@ void static BitcoinMiner_noeq()
                     {
 
                         UniValue params(UniValue::VARR);
+                        UniValue error(UniValue::VARR);
                         params.push_back(EncodeHexBlk(*pblock));
                         params.push_back(ASSETCHAINS_SYMBOL);
-                        params.push_back(PBAAS_HOST);
-                        params.push_back(PBAAS_PORT);
-                        params.push_back(PBAAS_USERPASS);
+                        params.push_back(ASSETCHAINS_RPCHOST);
+                        params.push_back(ASSETCHAINS_RPCPORT);
+                        params.push_back(ASSETCHAINS_RPCCREDENTIALS);
                         try
                         {
-                            params = find_value(RPCCallRoot("addmergedblock", params), "result");
+                            params = RPCCallRoot("addmergedblock", params);
+                            params = find_value(params, "result");
+                            error = find_value(params, "error");
                         } catch (std::exception e)
                         {
                             printf("Failed to connect to %s chain\n", ConnectedChains.notaryChain.chainDefinition.name.c_str());
                             params = UniValue(e.what());
                         }
-                        if (mergeMining = params.isNull())
+                        if (mergeMining = (params.isNull() && error.isNull()))
                         {
                             printf("Merge mining with %s as the actual mining chain\n", ConnectedChains.notaryChain.chainDefinition.name.c_str());
                             LogPrintf("Merge mining with %s\n",ASSETCHAINS_ALGORITHMS[ASSETCHAINS_ALGO]);
index de23ea98f2103c759ac5ee11cc1e6b678a3e8728..3904e5d6c792e0c1c55e25b82624c1069e12b293 100644 (file)
@@ -230,12 +230,12 @@ UniValue RPCCallRoot(const string& strMethod, const UniValue& params)
     }
     else if (ReadConfigFile(PBAAS_TESTMODE ? "VRSCTEST" : "VRSC", settings, settingsmulti))
     {
-        credentials = settingsmulti.find("-rpcuser")->second[0] + ":" + settingsmulti.find("-rpcpassword")->second[0];
-        port = atoi(settingsmulti.find("-rpcport")->second[0]);
-        host = settingsmulti.find("-rpchost")->second[0];
-        if (!host.size())
+        PBAAS_USERPASS = settingsmulti.find("-rpcuser")->second[0] + ":" + settingsmulti.find("-rpcpassword")->second[0];
+        PBAAS_PORT = atoi(settingsmulti.find("-rpcport")->second[0]);
+        PBAAS_HOST = settingsmulti.find("-rpchost")->second[0];
+        if (!PBAAS_HOST.size())
         {
-            host = "127.0.0.1";
+            PBAAS_HOST = "127.0.0.1";
         }
         return RPCCall(strMethod, params, credentials, port, host);
     }
This page took 0.038671 seconds and 4 git commands to generate.