Skip to content

Commit

Permalink
Merge pull request #53 from deertacos/internal_node_error
Browse files Browse the repository at this point in the history
Fix internal node error
  • Loading branch information
RocksteadyTC authored Feb 11, 2018
2 parents c1919b4 + 1af3f4e commit f448b0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/CryptoNoteCore/BlockchainCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,12 @@ uint32_t BlockchainCache::getTimestampLowerBoundBlockIndex(uint64_t timestamp) c
return 0;
}

uint32_t blockIndex = parent->getTimestampLowerBoundBlockIndex(timestamp);
return blockIndex == INVALID_BLOCK_INDEX ? blockIndex : startIndex;
try {
return parent->getTimestampLowerBoundBlockIndex(timestamp);
} catch (std::runtime_error&) {
// parent didn't have the block, so index.front() must be the block we're looking for
return startIndex;
}
}

bool BlockchainCache::getTransactionGlobalIndexes(const Crypto::Hash& transactionHash,
Expand Down
4 changes: 2 additions & 2 deletions src/CryptoNoteCore/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,8 @@ bool Core::queryBlocksLite(const std::vector<Crypto::Hash>& knownBlockHashes, ui
fillQueryBlockShortInfo(fullOffset, currentIndex, BLOCKS_SYNCHRONIZING_DEFAULT_COUNT, entries);

return true;
} catch (std::exception&) {
// TODO log
} catch (std::exception& e) {
logger(Logging::ERROR) << "Failed to query blocks: " << e.what();
return false;
}
}
Expand Down

0 comments on commit f448b0d

Please sign in to comment.