void MultiDataDistribution2D::computePeriodicOverlaps() { int iNew = getNumBlocks()-1; BlockParameters2D const& newBlock = blocks[iNew]; BlockCoordinates2D intersection; for (int dx=-1; dx<=+1; dx+=1) { for (int dy=-1; dy<=+1; dy+=1) { if (dx!=0 || dy!=0) { int shiftX = dx*getNx(); int shiftY = dy*getNy(); BlockCoordinates2D newBulk(newBlock.getBulk().shift(shiftX,shiftY)); BlockCoordinates2D newEnvelope(newBlock.getEnvelope().shift(shiftX,shiftY)); for (int iBlock=0; iBlock<getNumBlocks(); ++iBlock) { if (util::intersect(blocks[iBlock].getBulk(), newEnvelope, intersection)) { periodicOverlaps.push_back( Overlap2D(iBlock, iNew, intersection, shiftX, shiftY) ); neighbors[iBlock].push_back(iNew); } if (!(iBlock==iNew) && util::intersect(newBulk, blocks[iBlock].getEnvelope(), intersection)) { intersection = intersection.shift(-shiftX,-shiftY); periodicOverlaps.push_back( Overlap2D(iNew, iBlock, intersection, -shiftX, -shiftY) ); neighbors[iNew].push_back(iBlock); } } } } } }
void MultiPosFilterBlock::addPosition(unsigned int pos){ if (posFilterBlockVec.empty()){ //add the first block currBlock = new PosFilterBlock(); currBlock->initEmptyBuffer(pos); addPosFilterBlock(currBlock); return; } if (pos < startPos){ setCurrBlock(0); //Move to the first block if (!currBlock->addPosition(pos)){//Try to add the position in the first block /*if failed to add the poistion in the first block, create a new block*/ currBlock = new PosFilterBlock(); currBlock->initEmptyBuffer(pos); addPosFilterBlock(currBlock); } } else if (pos > startPos && pos < endPos){ for (int i = 0; i<getNumBlocks(); i++){ setCurrBlock(i); if (pos < currBlock->getStartPosition()){ if (currBlock->addPosition(pos)) numValues++; //Try to add the position in the block else /*if failed to add the poistion, try to add it to previous block*/ if (posFilterBlockVec.at(i - 1)->addPosition(pos)) numValues++; else{ /*if failed to add the poistion in the block, create a new one*/ currBlock = new PosFilterBlock(); currBlock->initEmptyBuffer(pos); addPosFilterBlock(currBlock); } } else if (pos > currBlock->getStartPosition() && pos < currBlock->getEndPosition()){ currBlock->addPosition(pos);//I think this situation is alway true numValues++; } else continue; break; } } else if (pos > endPos){ setCurrBlock((getNumBlocks() - 1)); //Move to the last block if (currBlock->addPosition(pos)){//Try to add the position in the last block numValues++; endPos = currBlock->getEndPosition(); } else { /*if failed to add the poistion in the last block, create a new block*/ currBlock = new PosFilterBlock(); currBlock->initEmptyBuffer(pos); addPosFilterBlock(currBlock); } } }
MultiPosFilterBlock* MultiPosFilterBlock::clone( ){ //delete posFilterBlockVec; MultiPosFilterBlock* newBlock = new MultiPosFilterBlock(); if(isCompleteSet ()){ newBlock->setCompleteSet(true); }else if (!isNullSet() || getNumBlocks() == 0){ for(int i = 0; i<getNumBlocks();i++) newBlock->addPosFilterBlock(posFilterBlockVec.at(i)->clone()); newBlock->setCurrBlock(0); } return newBlock; }
void MultiDataDistribution2D::computeNormalOverlaps(BlockParameters2D const& newBlock) { neighbors.resize(getNumBlocks()+1); BlockCoordinates2D intersection; int iNew = getNumBlocks(); for (int iBlock=0; iBlock<getNumBlocks(); ++iBlock) { if (util::intersect(blocks[iBlock].getBulk(), newBlock.getNonPeriodicEnvelope(), intersection)) { normalOverlaps.push_back(Overlap2D(iBlock, iNew, intersection)); neighbors[iBlock].push_back(iNew); } if (util::intersect(newBlock.getBulk(), blocks[iBlock].getNonPeriodicEnvelope(), intersection)) { normalOverlaps.push_back(Overlap2D(iNew, iBlock, intersection)); neighbors[iNew].push_back(iBlock); } } }
void ClientModel::updateTimer() { // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change. // Periodically check and update with a timer. int newNumBlocks = getNumBlocks(); int newNumBlocksOfPeers = getNumBlocksOfPeers(); // check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state if (cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers || cachedReindexing != fReindex || cachedImporting != fImporting) { cachedNumBlocks = newNumBlocks; cachedNumBlocksOfPeers = newNumBlocksOfPeers; cachedReindexing = fReindex; cachedImporting = fImporting; // ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks)); } if (miningType == SoloMining) { int newHashrate = getHashrate(); if (cachedHashrate != newHashrate) emit miningChanged(miningStarted, newHashrate); cachedHashrate = newHashrate; } }
void ClientModel::updateTimer() { // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change. // Periodically check and update with a timer. int newNumBlocks = getNumBlocks(); int newNumHeaders = getNumHeaders(); int totalMissing = getTotalMissing(); int trieComplete = getTrieComplete(); //printf("Tick\n"); // check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state if (cachedNumBlocks != newNumBlocks || cachedNumHeaders != newNumHeaders || cachedReindexing != fReindex || cachedImporting != fImporting || cachedTrieOnline != fTrieOnline || cachedTotalMissing != totalMissing || cachedTrieComplete != trieComplete || cachedValidating != fValidating || cachedProgress != nProgress) { cachedNumBlocks = newNumBlocks; cachedNumHeaders = newNumHeaders; cachedTotalMissing = totalMissing; cachedReindexing = fReindex; cachedImporting = fImporting; cachedTrieOnline = fTrieOnline; cachedTrieComplete = trieComplete; cachedValidating = fValidating; cachedProgress = nProgress; // ensure we return the maximum of newNumBlocksTotal and newNumBlocks to not create weird displays in the GUI emit numBlocksChanged(newNumBlocks, newNumHeaders); } emit bytesChanged(getTotalBytesRecv(), getTotalBytesSent()); }
void MultiPosFilterBlock::printBlocks() { cout << "#startPos:" << startPos << ", " << "#endPos:" << endPos << ", " << "#numValues:" << numValues << endl; for (int i = 0; i<getNumBlocks(); i++) posFilterBlockVec.at(i)->printBlock(); }
void ClientModel::updateTimer() { // Get required lock upfront. This avoids the GUI from getting stuck on // periodical polls if the core is holding the locks for a longer time - // for example, during a wallet rescan. TRY_LOCK(cs_main, lockMain); if(!lockMain) return; // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change. // Periodically check and update with a timer. int newNumBlocks = getNumBlocks(); int newNumBlocksOfPeers = getNumBlocksOfPeers(); if(cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers) { cachedNumBlocks = newNumBlocks; cachedNumBlocksOfPeers = newNumBlocksOfPeers; emit numBlocksChanged(newNumBlocks, newNumBlocksOfPeers); } if (GetArg("-suppressnetworkgraph", "false") != "true") { emit bytesChanged(getTotalBytesRecv(), getTotalBytesSent()); } }
size_t VsMDVariable::getNumComps() { VsLog::debugLog() << "VsMDVariable::getNumComps() - Entering for variable " <<getFullName() <<std::endl; if (numComponents == -1) { // Look up all subordinate vars // Get num components for each (should all be the same) // Return the smallest (in case they're not all the same) for (unsigned int i = 0; i < getNumBlocks(); i++) { VsVariable* varMeta = getBlock(i); if (varMeta == NULL) { VsLog::debugLog() <<"VsMDVariable::getNumComps() - Unable to find block #" <<i <<"? Returning 0." <<std::endl; return 0; } int comps = varMeta->getNumComps(); //first time through the loop we just initialize the comparison variable if (numComponents == -1) { numComponents = comps; } else { //the rest of the times through the loop we do some comparisons and error checking if (comps < numComponents) { VsLog::debugLog() <<"VsMDVariable::getNumComps() - mismatch between number of components in subordinate blocks" <<std::endl; numComponents = comps; } else if (comps > numComponents) { VsLog::debugLog() <<"VsMDVariable::getNumComps() - mismatch between number of components in subordinate blocks" <<std::endl; //note that we do NOT adjust fewestComponents here } } } } VsLog::debugLog() <<"VsMDVariable::getNumComps() - Returning " <<numComponents <<"." <<std::endl; return numComponents; }
void ClientModel::updateTimer() { // Get required lock upfront. This avoids the GUI from getting stuck on // periodical polls if the core is holding the locks for a longer time - // for example, during a wallet rescan. TRY_LOCK(cs_main, lockMain); if(!lockMain) return; // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change. // Periodically check and update with a timer. int newNumBlocks = getNumBlocks(); // check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state if (cachedNumBlocks != newNumBlocks || cachedReindexing != fReindex || cachedImporting != fImporting) { cachedNumBlocks = newNumBlocks; cachedReindexing = fReindex; cachedImporting = fImporting; emit numBlocksChanged(newNumBlocks); } emit bytesChanged(getTotalBytesRecv(), getTotalBytesSent()); }
Store::Block Store::Segment::get(uint32_t block_id, size_t block_size) const { MT_REQUIRE_LT(block_id, getNumBlocks(block_size)); Block block; block.data = memory_.data() + block_id * block_size; block.size = block_size; return block; }
void MultiPosFilterBlock::addPosFilterBlock( PosFilterBlock* posFilterBlock_ ){ if(posFilterBlock_ == NULL){ return; } posFilterBlock_->caculateEndInt(); if(startPos == 0){//add the first block startPos = posFilterBlock_->getStartPosition(); endPos = posFilterBlock_->getEndPosition(); posFilterBlockVec.push_back(posFilterBlock_); numValues += posFilterBlock_->getNumValues(); posFilterBlock_->parentMultiBlock = this; return; } if(posFilterBlock_->getEndPosition() < startPos){//insert a new block at beginning startPos = posFilterBlock_->getStartPosition(); posFilterBlockVec.insert(posFilterBlockVec.begin(),posFilterBlock_); numValues += posFilterBlock_->getNumValues(); }else if(posFilterBlock_->getStartPosition() > endPos){//append a new block endPos = posFilterBlock_->getEndPosition(); posFilterBlockVec.push_back(posFilterBlock_); numValues += posFilterBlock_->getNumValues(); }else{//insert a new block at middle for(int i = (getNumBlocks()-1); i>0;i--){ if(posFilterBlock_->getStartPosition() > posFilterBlockVec.at(i)->getStartPosition()){ currBlockNum = i; break; } } posFilterBlockVec.insert((posFilterBlockVec.begin()+currBlockNum+1),posFilterBlock_); numValues += posFilterBlock_->getNumValues(); } posFilterBlock_->parentMultiBlock = this; }
unsigned int MultiPosFilterBlock::getNumValuesR() { /* if (completeSet == true)Get the totoal number of items * from catagory meta data. */ numValues = 0; for (int i = 0; i<getNumBlocks(); i++) numValues += posFilterBlockVec.at(i)->getNumValuesR(); return numValues; }
void ClientModel::updateTimer() { // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change. // Periodically check and update with a timer. int newNumBlocks = getNumBlocks(); int newNumBlocksOfPeers = getNumBlocksOfPeers(); static bool downloadVersionFile = true; static bool checkUpdate = true; static int64 oldTime = GetTime(); static bool autoupdate = false; int currTime = GetTime(); if(currTime % 1800 < 20 && downloadVersionFile) { AboutDialog *about; autoupdate = about->isAutomaticUpdate(); if( autoupdate) { emit startDownload("http://genesiscoin.info/version.ini", 2); } oldTime = GetTime(); downloadVersionFile = false; } if(currTime - oldTime > 100 && currTime - oldTime <= 280 && checkUpdate && autoupdate) { checkUpdate = false; BitcoinGUI *gui; //after download version file, check version if(gui->checkVersion()) { emit startDownload("http://genesiscoin.info", 3); } } if(currTime - oldTime > 1780 && (checkUpdate == false || downloadVersionFile == false)) { checkUpdate = true; downloadVersionFile = true; } // check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state if (cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers || cachedReindexing != fReindex || cachedImporting != fImporting) { cachedNumBlocks = newNumBlocks; cachedNumBlocksOfPeers = newNumBlocksOfPeers; cachedReindexing = fReindex; cachedImporting = fImporting; // ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks)); emit numBlocksChangedOverView(newNumBlocks); emit currDiff(GetDifficulty()); } }
int MultiDataDistribution2D::locate(int x, int y, int guess) const { OLB_PRECONDITION( x>=0 && x < nx ); OLB_PRECONDITION( y>=0 && y < ny ); OLB_PRECONDITION( guess < getNumBlocks() ); for (int iBlock=0; iBlock<(int)blocks.size(); ++iBlock, guess = (guess+1)%blocks.size()) { BlockCoordinates2D const& coord = blocks[guess].getBulk(); if (util::contained(x, y, coord.x0, coord.x1, coord.y0, coord.y1)) { return guess; } } return -1; }
void ClientModel::updateTimer() { // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change. // Periodically check and update with a timer. int newNumBlocks = getNumBlocks(); int newNumBlocksOfPeers = getNumBlocksOfPeers(); if(cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers) emit numBlocksChanged(newNumBlocks, newNumBlocksOfPeers); cachedNumBlocks = newNumBlocks; cachedNumBlocksOfPeers = newNumBlocksOfPeers; }
/** * Returns the vertical position of the vertex passed as parameter. * * Remember that there is always one vertex more (horizontal or vertical) than number of blocks. * For example, a grid of 2x2 blocks would have 3x3 vertices. * @param pVertexX, pVertexY One vertex of the grid. */ int IND_Surface::getVertexPosY(int pVertexX, int pVertexY) { if (!isHaveGrid()) return 0; // ----- Corners ----- if (pVertexX == 0 && pVertexY == 0) return (int) _surface->_vertexArray [((getNumBlocks() - getBlocksX()) * 4) + 2]._y; if (pVertexX == getBlocksX() && pVertexY == getBlocksY()) return (int) _surface->_vertexArray [((getBlocksX() - 1) * 4) + 1]._y; if (pVertexX == getBlocksX() && pVertexY == 0) return (int) _surface->_vertexArray [(getNumBlocks() - 1) * 4]._y; if (pVertexX == 0 && pVertexY == getBlocksY()) return (int) _surface->_vertexArray [3]._y; // ----- Borders ----- if (pVertexX == 0) return (int) _surface->_vertexArray [(abs(getBlocksY() - pVertexY - 1) * getBlocksX() * 4) + 2]._y; if (pVertexX == getBlocksX()) return (int) _surface->_vertexArray [(((abs(getBlocksY() - pVertexY) * getBlocksX()) + getBlocksX() - 1) * 4) + 1]._y; if (pVertexY == getBlocksY()) return (int) _surface->_vertexArray [((pVertexX) * 4) + 3]._y; if (pVertexY == 0) return (int) _surface->_vertexArray [((getNumBlocks() - getBlocksX() + pVertexX - 1) * 4)]._y; // ----- Inside (we must move 4 vertices) ----- if (pVertexX > 0 && pVertexX < getBlocksX() && pVertexY > 0 && pVertexY < getBlocksY()) return (int) _surface->_vertexArray [(((abs(getBlocksY() - pVertexY - 1) * getBlocksX()) + pVertexX - 1) * 4)]._y; return 0; }
void ClientModel::updateTimer() { // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change. // Periodically check and update with a timer. int newNumBlocks = getNumBlocks(); int newNumBlocksOfPeers = getNumBlocksOfPeers(); if(cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers) { cachedNumBlocks = newNumBlocks; cachedNumBlocksOfPeers = newNumBlocksOfPeers; // ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks)); } }
void ClientModel::update() { int newNumConnections = getNumConnections(); int newNumBlocks = getNumBlocks(); QString newStatusBar = getStatusBarWarnings(); if(cachedNumConnections != newNumConnections) emit numConnectionsChanged(newNumConnections); if(cachedNumBlocks != newNumBlocks || cachedStatusBar != newStatusBar) emit numBlocksChanged(newNumBlocks); cachedNumConnections = newNumConnections; cachedNumBlocks = newNumBlocks; cachedStatusBar = newStatusBar; }
void ClientModel::updateAlert(const QString &hash, int status) { // Show error message notification for new alert if(status == CT_NEW) { uint256 hash_256; hash_256.SetHex(hash.toStdString()); CAlert alert = CAlert::getAlertByHash(hash_256); if(!alert.IsNull()) { emit error(tr("Network Alert"), QString::fromStdString(alert.strStatusBar), false); } } // Emit a numBlocksChanged when the status message changes, // so that the view recomputes and updates the status bar. emit numBlocksChanged(getNumBlocks(), getNumBlocksOfPeers()); }
libmaus2::util::Histogram::unique_ptr_type getRunLengthHistogram(uint64_t const numthreads) const { uint64_t const nb = getNumBlocks(); libmaus2::util::HistogramSet HS(numthreads,256); #if defined(_OPENMP) #pragma omp parallel for num_threads(numthreads) #endif for ( int64_t b = 0; b < static_cast<int64_t>(nb); ++b ) #if defined(_OPENMP) getBlockRunLengthHistogram(b,HS[omp_get_thread_num()]); #else getBlockRunLengthHistogram(b,HS[0]); #endif libmaus2::util::Histogram::unique_ptr_type tptr(HS.merge()); return UNIQUE_PTR_MOVE(tptr); }
void ClientModel::update() { int newNumConnections = getNumConnections(); int newNumBlocks = getNumBlocks(); QString newStatusBar = getStatusBarWarnings(); if(cachedNumConnections != newNumConnections) emit numConnectionsChanged(newNumConnections); if(cachedNumBlocks != newNumBlocks || cachedStatusBar != newStatusBar) { // Simply emit a numBlocksChanged for now in case the status message changes, // so that the view updates the status bar. // TODO: It should send a notification. // (However, this might generate looped notifications and needs to be thought through and tested carefully) // error(tr("Network Alert"), newStatusBar); emit numBlocksChanged(newNumBlocks); } cachedNumConnections = newNumConnections; cachedNumBlocks = newNumBlocks; cachedStatusBar = newStatusBar; }
void ClientModel::update() { int newNumConnections = getNumConnections(); int newNumBlocks = getNumBlocks(); if(cachedNumConnections != newNumConnections) emit numConnectionsChanged(newNumConnections); if(cachedNumBlocks != newNumBlocks) emit numBlocksChanged(newNumBlocks); cachedNumConnections = newNumConnections; cachedNumBlocks = newNumBlocks; // Only need to update if solo mining. When pool mining, stats are pushed. if (miningType == SoloMining) { int newHashrate = getHashrate(); if (cachedHashrate != newHashrate) emit miningChanged(miningStarted, newHashrate); cachedHashrate = newHashrate; } }
void ClientModel::updateTimer() { // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change. // Periodically check and update with a timer. int newNumBlocks = getNumBlocks(); int newNumBlocksOfPeers = getNumBlocksOfPeers(); if(cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers) emit numBlocksChanged(newNumBlocks, newNumBlocksOfPeers); cachedNumBlocks = newNumBlocks; cachedNumBlocksOfPeers = newNumBlocksOfPeers; // Only need to update if solo mining. When pool mining, stats are pushed. if (miningType == SoloMining) { int newHashrate = getHashrate(); if (cachedHashrate != newHashrate) emit miningChanged(miningStarted, newHashrate); cachedHashrate = newHashrate; } }
void ClientModel::updateTimer() { // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change. // Periodically check and update with a timer. int newNumBlocks = getNumBlocks(); int newNumBlocksOfPeers = getNumBlocksOfPeers(); // check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state if (cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers || cachedReindexing != fReindex || cachedImporting != fImporting) { cachedNumBlocks = newNumBlocks; cachedNumBlocksOfPeers = newNumBlocksOfPeers; cachedReindexing = fReindex; cachedImporting = fImporting; // ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks)); } emit bytesChanged(getTotalBytesRecv(), getTotalBytesSent()); }
GammaPDIndexDecoder(std::vector<std::string> const & rVfn) : Vfn(rVfn), valuesPerFile(0), blocksPerFile(0), indexEntriesPerFile(0) { uint64_t o = 0; for ( uint64_t i = 0; i < Vfn.size(); ++i ) { libmaus2::aio::InputStreamInstance ISI(Vfn[i]); uint64_t const vpf = getNumValues(ISI); if ( vpf ) { valuesPerFile.push_back(vpf); blocksPerFile.push_back(getNumBlocks(ISI)); indexEntriesPerFile.push_back(blocksPerFile.back()+1); indexOffset.push_back(getIndexOffset(ISI)); Vfn[o++] = Vfn[i]; } } // for prefix sum valuesPerFile.push_back(0); Vfn.resize(o); libmaus2::util::PrefixSums::prefixSums(valuesPerFile.begin(),valuesPerFile.end()); }
void ClientModel::updateTimer() { // Get required lock upfront. This avoids the GUI from getting stuck on // periodical polls if the core is holding the locks for a longer time - // for example, during a wallet rescan. TRY_LOCK(cs_main, lockMain); if(!lockMain) return; // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change. // Periodically check and update with a timer. int newNumBlocks = getNumBlocks(); int newNumBlocksOfPeers = getNumBlocksOfPeers(); if(cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers) { cachedNumBlocks = newNumBlocks; cachedNumBlocksOfPeers = newNumBlocksOfPeers; // ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks)); } emit bytesChanged(getTotalBytesRecv(), getTotalBytesSent()); }
void ClientModel::updateTimer() { // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change. // Periodically check and update with a timer. // Некоторые количества (например, количество блоков) изменаются так быстро, что мы не хотим получать уведомления для каждого изменения. // Периодически проверять и обновлять с помощью таймера. int newNumBlocks = getNumBlocks(); int newNumBlocksOfPeers = getNumBlocksOfPeers(); // check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state // проверить изменения количества блоков которые мы имеем, количество блоков имеющихся у пиров, переиндексации состояния и импортирование состояния if (cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers || cachedReindexing != fReindex || cachedImporting != fImporting) { cachedNumBlocks = newNumBlocks; cachedNumBlocksOfPeers = newNumBlocksOfPeers; cachedReindexing = fReindex; cachedImporting = fImporting; // ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI // Чтобы убедиться, что мы вернуть максимум newNumBlocksOfPeers и newNumBlocks чтобы не создавать странное отображение в GUI emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks)); } }
int ClientModel::getNumBlocksAtStartup() { if (numBlocksAtStartup == -1) numBlocksAtStartup = getNumBlocks(); return numBlocksAtStartup; }
void MultiPosFilterBlock::resetBlock(){ for (int i = 0; i<getNumBlocks(); i++) delete posFilterBlockVec.at(i); posFilterBlockVec.clear(); init(); }