This commit is contained in:
jl777
2016-11-19 18:07:04 -03:00
parent 055db9b60e
commit 43450135b5
2 changed files with 12 additions and 9 deletions

View File

@@ -560,7 +560,7 @@ void komodo_iteration(char *symbol)
void komodo_passport_iteration() void komodo_passport_iteration()
{ {
static long lastpos[34],didinit; static char userpass[33][1024]; static long lastpos[34],didinit; static char userpass[33][1024];
FILE *fp; int32_t baseid,isrealtime,refid,blocks,longest; struct komodo_state *sp; char *retstr,fname[512],*base,symbol[16],dest[16]; cJSON *infoobj; uint16_t port; uint32_t magic; FILE *fp; int32_t baseid,isrealtime,refid,blocks,longest; struct komodo_state *sp; char *retstr,fname[512],*base,symbol[16],dest[16]; cJSON *infoobj,*result; uint16_t port; uint32_t magic;
if ( didinit == 0 ) if ( didinit == 0 )
{ {
for (baseid=0; baseid<=32; baseid++) for (baseid=0; baseid<=32; baseid++)
@@ -598,14 +598,17 @@ void komodo_passport_iteration()
{ {
if ( (infoobj= cJSON_Parse(retstr)) != 0 ) if ( (infoobj= cJSON_Parse(retstr)) != 0 )
{ {
blocks = juint(infoobj,(char *)"blocks"); if ( (result= jobj(infoobj,"result")) != 0 )
longest = juint(infoobj,(char *)"longestchain"); {
printf("(%s %d %d) ",base,blocks,longest); blocks = juint(infoobj,(char *)"blocks");
if ( blocks > 0 && blocks == longest ) longest = juint(infoobj,(char *)"longestchain");
isrealtime = 1; printf("%s.(%d L%d) ",base,blocks,longest);
if ( blocks > 0 && blocks == longest )
isrealtime = 1;
}
free_json(infoobj); free_json(infoobj);
} }
printf("(%s)\n",retstr); //printf("(%s)\n",retstr);
free(retstr); free(retstr);
} else printf("%s port.%u no getinfo\n",base,port); } else printf("%s port.%u no getinfo\n",base,port);
} else printf("fname.(%s) cant open\n",fname); } else printf("fname.(%s) cant open\n",fname);

View File

@@ -535,10 +535,10 @@ CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& loc
// Find the first block the caller has in the main chain // Find the first block the caller has in the main chain
BOOST_FOREACH(const uint256& hash, locator.vHave) { BOOST_FOREACH(const uint256& hash, locator.vHave) {
BlockMap::iterator mi = mapBlockIndex.find(hash); BlockMap::iterator mi = mapBlockIndex.find(hash);
if (mi != mapBlockIndex.end()) if (mi != 0 && mi != mapBlockIndex.end())
{ {
CBlockIndex* pindex = (*mi).second; CBlockIndex* pindex = (*mi).second;
if (chain.Contains(pindex)) if (pindex != 0 && chain.Contains(pindex))
return pindex; return pindex;
} }
} }