diff --git a/src/logging/logging.h b/src/logging/logging.h index d581f652..7a0072eb 100644 --- a/src/logging/logging.h +++ b/src/logging/logging.h @@ -277,7 +277,8 @@ class qLogger inline static BlobInfo* mapLogIdToBufferIndex = NULL; inline static unsigned long long logBufferTail; inline static unsigned long long logId; - inline static unsigned int tickBegin; + inline static unsigned int tickBegin; // initial tick of the epoch + inline static unsigned int tickLoadedFrom; // tick that this node load from (save/load state feature) inline static unsigned int currentTxId; inline static unsigned int currentTick; inline static BlobInfo currentTxInfo; @@ -471,7 +472,7 @@ class qLogger return false; } } - reset(0); + reset(0, 0); #endif return true; } @@ -497,7 +498,7 @@ class qLogger #endif } - static void reset(unsigned int _tickBegin) + static void reset(unsigned int _tickBegin, unsigned int _tickLoadedFrom) { #if ENABLED_LOGGING logBuf.init(); @@ -505,6 +506,7 @@ class qLogger logBufferTail = 0; logId = 0; tickBegin = _tickBegin; + tickLoadedFrom = _tickLoadedFrom; #endif } diff --git a/src/logging/net_msg_impl.h b/src/logging/net_msg_impl.h index e4ffdf85..13467eac 100644 --- a/src/logging/net_msg_impl.h +++ b/src/logging/net_msg_impl.h @@ -76,9 +76,18 @@ void qLogger::processRequestTxLogInfo(Peer* peer, RequestResponseHeader* header) ) { ResponseLogIdRangeFromTx resp; - BlobInfo info = tx.getLogIdInfo(request->tick, request->txId); - resp.fromLogId = info.startIndex; - resp.length = info.length; + if (request->tick < tickLoadedFrom) + { + // unknown logging because the whole node memory is loaded from files + resp.fromLogId = -2; + resp.length = -2; + } + else + { + BlobInfo info = tx.getLogIdInfo(request->tick, request->txId); + resp.fromLogId = info.startIndex; + resp.length = info.length; + } enqueueResponse(peer, sizeof(ResponseLogIdRangeFromTx), ResponseLogIdRangeFromTx::type, header->dejavu(), &resp); return; } @@ -100,12 +109,24 @@ void qLogger::processRequestTickTxLogInfo(Peer* peer, RequestResponseHeader* hea { ResponseAllLogIdRangesFromTick resp; int txId = 0; - for (txId = 0; txId < LOG_TX_PER_TICK; txId++) + if (request->tick < tickLoadedFrom) { - BlobInfo info = tx.getLogIdInfo(request->tick, txId); - resp.fromLogId[txId] = info.startIndex; - resp.length[txId] = info.length; + // unknown logging because the whole node memory is loaded from files + for (txId = 0; txId < LOG_TX_PER_TICK; txId++) + { + resp.fromLogId[txId] = -2; + resp.length[txId] = -2; + } } + else + { + for (txId = 0; txId < LOG_TX_PER_TICK; txId++) + { + BlobInfo info = tx.getLogIdInfo(request->tick, txId); + resp.fromLogId[txId] = info.startIndex; + resp.length[txId] = info.length; + } + } enqueueResponse(peer, sizeof(ResponseAllLogIdRangesFromTick), ResponseAllLogIdRangesFromTick::type, header->dejavu(), &resp); return; } diff --git a/src/public_settings.h b/src/public_settings.h index bec85c0d..812ec556 100644 --- a/src/public_settings.h +++ b/src/public_settings.h @@ -50,11 +50,11 @@ #define VERSION_A 1 #define VERSION_B 230 -#define VERSION_C 1 +#define VERSION_C 2 // Epoch and initial tick for node startup -#define EPOCH 141 -#define TICK 18017311 +#define EPOCH 142 +#define TICK 18168941 #define ARBITRATOR "AFZPUAIYVPNUYGJRQVLUKOPPVLHAZQTGLYAAUUNBXFTVTAMSBKQBLEIEPCVJ" diff --git a/src/qubic.cpp b/src/qubic.cpp index 8917b706..35c1e374 100644 --- a/src/qubic.cpp +++ b/src/qubic.cpp @@ -2282,7 +2282,7 @@ static void processTick(unsigned long long processorNumber) if (system.tick == system.initialTick) { - logger.reset(system.initialTick); // clear logs here to give more time for querying and persisting the data when we do seamless transition + logger.reset(system.initialTick, system.initialTick); // clear logs here to give more time for querying and persisting the data when we do seamless transition logger.registerNewTx(system.tick, logger.SC_INITIALIZE_TX); contractProcessorPhase = INITIALIZE; contractProcessorState = 1; @@ -3410,7 +3410,7 @@ static bool loadAllNodeStates() #if ENABLED_LOGGING logToConsole(L"Initializing logger"); - logger.reset(system.initialTick); // initialize the logger + logger.reset(system.initialTick, system.tick); // initialize the logger #endif return true; }