Merge pull request #476 from jl777/dev
fixed wrong port used by assetchains, which caused error many times, each with 250ms sleep
This commit is contained in:
@@ -126,6 +126,15 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &)
|
||||
// singleton request
|
||||
if (valRequest.isObject()) {
|
||||
jreq.parse(valRequest);
|
||||
|
||||
if (!RPCAuthorized(authHeader.second)) {
|
||||
LogPrintf("ThreadRPCServer incorrect password attempt from %s\n", req->GetPeer().ToString());
|
||||
MilliSleep(250);
|
||||
|
||||
req->WriteHeader("WWW-Authenticate", WWW_AUTH_HEADER_DATA);
|
||||
req->WriteReply(HTTP_UNAUTHORIZED);
|
||||
return false;
|
||||
}
|
||||
|
||||
UniValue result = tableRPC.execute(jreq.strMethod, jreq.params);
|
||||
|
||||
|
||||
@@ -340,6 +340,7 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port)
|
||||
sprintf(url,(char *)"http://127.0.0.1:%u",port);
|
||||
sprintf(postdata,"{\"method\":\"%s\",\"params\":%s}",method,params);
|
||||
//printf("postdata.(%s) USERPASS.(%s)\n",postdata,KMDUSERPASS);
|
||||
//LogPrintf("komodo_issuemethod userpass.(%s) %s %s port.%u\n",userpass,method,params,port);
|
||||
retstr2 = bitcoind_RPC(&retstr,(char *)"debug",url,userpass,method,params);
|
||||
//retstr = curl_post(&cHandle,url,USERPASS,postdata,0,0,0,0);
|
||||
}
|
||||
@@ -353,7 +354,7 @@ int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heig
|
||||
*kmdnotarized_heightp = 0;
|
||||
if ( strcmp(dest,"KMD") == 0 )
|
||||
{
|
||||
port = BITCOIND_PORT;
|
||||
port = 7771;
|
||||
userpass = KMDUSERPASS;
|
||||
}
|
||||
else if ( strcmp(dest,"BTC") == 0 )
|
||||
@@ -431,8 +432,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t
|
||||
if ( strcmp(dest,"KMD") == 0 )
|
||||
{
|
||||
if ( KMDUSERPASS[0] != 0 )
|
||||
jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,BITCOIND_PORT);
|
||||
//else jsonstr = _dex_getrawtransaction();
|
||||
jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771);
|
||||
else return(0); // need universal way to issue DEX* API, since notaries mine most blocks, this ok
|
||||
}
|
||||
else if ( strcmp(dest,"BTC") == 0 )
|
||||
|
||||
@@ -1510,6 +1510,7 @@ void komodo_args()
|
||||
extern int COINBASE_MATURITY;
|
||||
komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1);
|
||||
COINBASE_MATURITY = 1;
|
||||
LogPrintf("ASSETCHAINS_PORT %s %u\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT);
|
||||
}
|
||||
ASSETCHAINS_NOTARIES = GetArg("-ac_notaries","");
|
||||
komodo_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str());
|
||||
|
||||
@@ -1055,7 +1055,9 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
|
||||
setTips.insert(item.second);
|
||||
BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex)
|
||||
{
|
||||
const CBlockIndex* pprev = item.second->pprev;
|
||||
const CBlockIndex* pprev=0;
|
||||
if ( item.second != 0 )
|
||||
pprev = item.second->pprev;
|
||||
if (pprev)
|
||||
setTips.erase(pprev);
|
||||
}
|
||||
@@ -1064,38 +1066,40 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
|
||||
setTips.insert(chainActive.Tip());
|
||||
|
||||
/* Construct the output array. */
|
||||
UniValue res(UniValue::VARR);
|
||||
UniValue res(UniValue::VARR); const CBlockIndex *forked;
|
||||
BOOST_FOREACH(const CBlockIndex* block, setTips)
|
||||
{
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("height", block->nHeight));
|
||||
obj.push_back(Pair("hash", block->phashBlock->GetHex()));
|
||||
|
||||
const int branchLen = block->nHeight - chainActive.FindFork(block)->nHeight;
|
||||
obj.push_back(Pair("branchlen", branchLen));
|
||||
|
||||
string status;
|
||||
if (chainActive.Contains(block)) {
|
||||
// This block is part of the currently active chain.
|
||||
status = "active";
|
||||
} else if (block->nStatus & BLOCK_FAILED_MASK) {
|
||||
// This block or one of its ancestors is invalid.
|
||||
status = "invalid";
|
||||
} else if (block->nChainTx == 0) {
|
||||
// This block cannot be connected because full block data for it or one of its parents is missing.
|
||||
status = "headers-only";
|
||||
} else if (block->IsValid(BLOCK_VALID_SCRIPTS)) {
|
||||
// This block is fully validated, but no longer part of the active chain. It was probably the active block once, but was reorganized.
|
||||
status = "valid-fork";
|
||||
} else if (block->IsValid(BLOCK_VALID_TREE)) {
|
||||
// The headers for this block are valid, but it has not been validated. It was probably never part of the most-work chain.
|
||||
status = "valid-headers";
|
||||
} else {
|
||||
// No clue.
|
||||
status = "unknown";
|
||||
forked = chainActive.FindFork(block);
|
||||
if ( forked != 0 )
|
||||
{
|
||||
const int branchLen = block->nHeight - forked->nHeight;
|
||||
obj.push_back(Pair("branchlen", branchLen));
|
||||
|
||||
string status;
|
||||
if (chainActive.Contains(block)) {
|
||||
// This block is part of the currently active chain.
|
||||
status = "active";
|
||||
} else if (block->nStatus & BLOCK_FAILED_MASK) {
|
||||
// This block or one of its ancestors is invalid.
|
||||
status = "invalid";
|
||||
} else if (block->nChainTx == 0) {
|
||||
// This block cannot be connected because full block data for it or one of its parents is missing.
|
||||
status = "headers-only";
|
||||
} else if (block->IsValid(BLOCK_VALID_SCRIPTS)) {
|
||||
// This block is fully validated, but no longer part of the active chain. It was probably the active block once, but was reorganized.
|
||||
status = "valid-fork";
|
||||
} else if (block->IsValid(BLOCK_VALID_TREE)) {
|
||||
// The headers for this block are valid, but it has not been validated. It was probably never part of the most-work chain.
|
||||
status = "valid-headers";
|
||||
} else {
|
||||
// No clue.
|
||||
status = "unknown";
|
||||
}
|
||||
obj.push_back(Pair("status", status));
|
||||
}
|
||||
obj.push_back(Pair("status", status));
|
||||
|
||||
res.push_back(obj);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user