diff options
Diffstat (limited to '')
-rw-r--r-- | src/blockchain_utilities/blockchain_blackball.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/blockchain_utilities/blockchain_blackball.cpp b/src/blockchain_utilities/blockchain_blackball.cpp index d9a179f64..1c6e54d10 100644 --- a/src/blockchain_utilities/blockchain_blackball.cpp +++ b/src/blockchain_utilities/blockchain_blackball.cpp @@ -558,7 +558,7 @@ static std::vector<output_data> get_spent_outputs(MDB_txn *txn) int dbr = mdb_cursor_open(txn, dbi_spent, &cur); CHECK_AND_ASSERT_THROW_MES(!dbr, "Failed to open cursor for spent outputs: " + std::string(mdb_strerror(dbr))); MDB_val k, v; - uint64_t count = 0; + mdb_size_t count = 0; dbr = mdb_cursor_get(cur, &k, &v, MDB_FIRST); if (dbr != MDB_NOTFOUND) { @@ -898,7 +898,11 @@ static std::vector<std::pair<uint64_t, uint64_t>> load_outputs(const std::string while (1) { char s[256]; - fgets(s, sizeof(s), f); + if (!fgets(s, sizeof(s), f)) + { + MERROR("Error reading from " << filename << ": " << strerror(errno)); + break; + } if (feof(f)) break; const size_t len = strlen(s); @@ -968,7 +972,7 @@ static bool export_spent_outputs(MDB_cursor *cur, const std::string &filename) if (pending_offsets.size() == 1) fprintf(f, "%" PRIu64 "\n", pending_offsets.front()); else - fprintf(f, "%" PRIu64 "*%" PRIu64 "\n", pending_offsets.front(), pending_offsets.size()); + fprintf(f, "%" PRIu64 "*%zu\n", pending_offsets.front(), pending_offsets.size()); pending_offsets.clear(); } if (pending_amount != amount) @@ -983,7 +987,7 @@ static bool export_spent_outputs(MDB_cursor *cur, const std::string &filename) if (pending_offsets.size() == 1) fprintf(f, "%" PRIu64 "\n", pending_offsets.front()); else - fprintf(f, "%" PRIu64 "*%" PRIu64 "\n", pending_offsets.front(), pending_offsets.size()); + fprintf(f, "%" PRIu64 "*%zu\n", pending_offsets.front(), pending_offsets.size()); pending_offsets.clear(); } fclose(f); @@ -1396,7 +1400,7 @@ int main(int argc, char* argv[]) if (stop_requested) { MINFO("Stopping secondary passes. Secondary passes are not incremental, they will re-run fully."); - return false; + return 0; } } if (!blackballs.empty()) |