From c3d91e3bae0b611ca3607704ce00212eca6c53ef Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Jul 2018 00:36:23 -1100 Subject: [PATCH] Autodetect insync status --- src/main.cpp | 2 +- src/rpcnet.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c6d6dee17..1e3ee8019 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3471,7 +3471,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1; LogPrint("bench", " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001); LogPrint("bench", "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001); - if ( KOMODO_LONGESTCHAIN != 0 && pindexNew->nHeight >= KOMODO_LONGESTCHAIN+1 ) + if ( KOMODO_LONGESTCHAIN != 0 && pindexNew->nHeight >= KOMODO_LONGESTCHAIN ) KOMODO_INSYNC = 1; else KOMODO_INSYNC = 0; fprintf(stderr,"connect.%d insync.%d\n",(int32_t)pindexNew->nHeight,KOMODO_INSYNC); diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index 33a1c317d..27650aa17 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -196,8 +196,9 @@ int32_t komodo_longestchain() } if ( num > (n >> 1) ) { + if ( height != KOMODO_LONGESTCHAIN ) + fprintf(stderr,"set %s KOMODO_LONGESTCHAIN <- %d\n",ASSETCHAINS_SYMBOL,height); KOMODO_LONGESTCHAIN = height; - fprintf(stderr,"set KOMODO_LONGESTCHAIN <- %d\n",height); return(height); } KOMODO_LONGESTCHAIN = 0;