Check mode no longer updates the last block height
-Also add output displaying which block is currently being checked as before it was almost impossible to determine what, if anything was happening in check mode
This commit is contained in:
+4
-2
@@ -955,7 +955,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
// updates tx, address & richlist db's; called by sync.js
|
||||
update_tx_db: function(coin, start, end, txes, timeout, cb) {
|
||||
update_tx_db: function(coin, start, end, txes, timeout, check_only, cb) {
|
||||
var complete = false;
|
||||
var blocks_to_scan = [];
|
||||
var task_limit_blocks = settings.sync.block_parallel_tasks;
|
||||
@@ -972,11 +972,13 @@ module.exports = {
|
||||
blocks_to_scan.push(i);
|
||||
|
||||
async.eachLimit(blocks_to_scan, task_limit_blocks, function(block_height, next_block) {
|
||||
if (block_height % settings.sync.save_stats_after_sync_blocks === 0) {
|
||||
if (!check_only && block_height % settings.sync.save_stats_after_sync_blocks === 0) {
|
||||
Stats.updateOne({coin: coin}, {
|
||||
last: block_height - 1,
|
||||
txes: txes
|
||||
}, function() {});
|
||||
} else if (check_only) {
|
||||
console.log('checking block ' + block_height + '...');
|
||||
}
|
||||
|
||||
lib.get_blockhash(block_height, function(blockhash) {
|
||||
|
||||
@@ -28,7 +28,7 @@ mongoose.connect(dbString, { useNewUrlParser: true, useCreateIndex: true, useUni
|
||||
Address.deleteMany({}, function(err2) {
|
||||
var s_timer = new Date().getTime();
|
||||
|
||||
db.update_tx_db(settings.coin.name, 1, COUNT, 0, settings.sync.update_timeout, function() {
|
||||
db.update_tx_db(settings.coin.name, 1, COUNT, 0, settings.sync.update_timeout, false, function() {
|
||||
var e_timer = new Date().getTime();
|
||||
|
||||
Tx.countDocuments({}, function(txerr, txcount) {
|
||||
|
||||
+3
-3
@@ -308,7 +308,7 @@ if (database == 'peers') {
|
||||
// Check if the sync msg should be shown
|
||||
check_show_sync_message(stats.count);
|
||||
|
||||
db.update_tx_db(settings.coin.name, 1, stats.count, stats.txes, settings.sync.update_timeout, function() {
|
||||
db.update_tx_db(settings.coin.name, 1, stats.count, stats.txes, settings.sync.update_timeout, false, function() {
|
||||
db.update_richlist('received', function() {
|
||||
db.update_richlist('balance', function() {
|
||||
db.get_stats(settings.coin.name, function(nstats) {
|
||||
@@ -333,7 +333,7 @@ if (database == 'peers') {
|
||||
} else if (mode == 'check') {
|
||||
console.log('starting check.. please wait..');
|
||||
|
||||
db.update_tx_db(settings.coin.name, 1, stats.count, stats.txes, settings.sync.check_timeout, function() {
|
||||
db.update_tx_db(settings.coin.name, 1, stats.count, stats.txes, settings.sync.check_timeout, true, function() {
|
||||
db.get_stats(settings.coin.name, function(nstats) {
|
||||
console.log('check complete (block: %s)', nstats.last);
|
||||
exit();
|
||||
@@ -347,7 +347,7 @@ if (database == 'peers') {
|
||||
// Check if the sync msg should be shown
|
||||
check_show_sync_message(count - last);
|
||||
|
||||
db.update_tx_db(settings.coin.name, last, count, stats.txes, settings.sync.update_timeout, function() {
|
||||
db.update_tx_db(settings.coin.name, last, count, stats.txes, settings.sync.update_timeout, false, function() {
|
||||
db.update_richlist('received', function() {
|
||||
db.update_richlist('balance', function() {
|
||||
db.get_stats(settings.coin.name, function(nstats) {
|
||||
|
||||
Reference in New Issue
Block a user