Rely on cached KOMODO_LONGESTCHAIN in netinfo

This commit is contained in:
jl777
2018-04-25 15:17:07 +03:00
parent 6bb74a0256
commit daf214b1b6
3 changed files with 6 additions and 4 deletions

View File

@@ -39,11 +39,13 @@ struct komodo_event *komodo_eventadd(struct komodo_state *sp,int32_t height,char
void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t height,char *dest,uint256 notarized_hash,uint256 notarized_desttxid,int32_t notarizedheight,uint256 MoM,int32_t MoMdepth)
{
struct komodo_event_notarized N;
if ( NOTARY_PUBKEY33[0] != 0 && komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid) != 0 )
static uint32_t counter; char *coin; struct komodo_event_notarized N;
coin = (ASSETCHAINS_SYMBOL[0] == 0) ? (char *)"KMD" : ASSETCHAINS_SYMBOL;
if ( counter < 10 && NOTARY_PUBKEY33[0] != 0 && strcmp(symbol,coin) == 0 && komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid) != 0 )
{
if ( height > 50000 || ASSETCHAINS_SYMBOL[0] != 0 )
printf("[%s] error validating notarization ht.%d notarized_height.%d, if on a pruned %s node this can be ignored\n",ASSETCHAINS_SYMBOL,height,notarizedheight,dest);
counter++;
}
else
{

View File

@@ -1459,7 +1459,7 @@ void komodo_passport_iteration()
if ( sp != 0 && isrealtime == 0 )
refsp->RTbufs[0][2] = 0;
}
komodo_paxtotal();
komodo_paxtotal(); // calls komodo_isrealtime(), which calls komodo_longestchain()
refsp->RTmask |= RTmask;
if ( expired == 0 && KOMODO_PASSPORT_INITDONE == 0 )
{

View File

@@ -123,7 +123,7 @@ UniValue getinfo(const UniValue& params, bool fHelp)
}
#endif
obj.push_back(Pair("blocks", (int)chainActive.Height()));
if ( (longestchain= komodo_longestchain()) != 0 && chainActive.Height() > longestchain )
if ( (longestchain= KOMODO_LONGESTCHAIN) != 0 && chainActive.Height() > longestchain )
longestchain = chainActive.Height();
//fprintf(stderr,"after longestchain\n");
obj.push_back(Pair("longestchain", longestchain));