Skip to content

Commit

Permalink
Handle a couple crashes better
Browse files Browse the repository at this point in the history
  • Loading branch information
hkalodner committed Mar 15, 2018
1 parent 2565016 commit faef367
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions clustering/src/clusterer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ std::vector<std::pair<Address, Address>> process_transaction(const Transaction &
template <typename Job>
void segmentWork(uint32_t start, uint32_t end, uint32_t segmentCount, Job job) {
uint32_t total = end - start;

// Don't partition over threads if there are less items than segment count
if (total < segmentCount) {
for (uint32_t i = start; i < end; ++i) {
job(i);
}
return;
}

auto segmentSize = total / segmentCount;
auto segmentsRemaining = total % segmentCount;
std::vector<std::pair<uint32_t, uint32_t>> segments;
Expand Down
4 changes: 4 additions & 0 deletions src/blocksci/util/data_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ namespace blocksci {
if (versionNum != dataVersion) {
throw std::runtime_error("Error, parser data is not in the correct format. To fix you must delete the data file and rerun the parser");
}
} else {
std::stringstream ss;
ss << "Error, data directory does not contain config.ini. Are you sure " << dataDirectory << "was the output directory of blocksci_parser?";
throw std::runtime_error(ss.str());
}

auto dataDirectoryString = dataDirectory.native();
Expand Down

0 comments on commit faef367

Please sign in to comment.