Fix negative stat value issue after attempted sync

-Better error handling of update_db()
-Fixes an issue that can cause some stats values to get set to a negative number when running an index sync and the wallet daemon has not finished loading the blockchain yet (If this happens to you, stop the explorer, apply this fix with `git pull` to make sure it doesn't happen again, then run a reindex-txcount and reindex-last to restore the proper values)
This commit is contained in:
joeuhren
2021-02-03 20:54:15 -07:00
parent 182ad875e9
commit ab6c341bf4
2 changed files with 120 additions and 113 deletions
+2 -1
View File
@@ -828,7 +828,8 @@ module.exports = {
// updates stats data for given coin; called by sync.js
update_db: function(coin, cb) {
lib.get_blockcount( function (count) {
if (!count) {
// check to ensure count is a positive number
if (!count || (count != null && typeof count === 'number' && count < 0)) {
console.log('Unable to connect to explorer API');
return cb(false);
}