start from actual last known block height when updating index
This commit is contained in:
+15
-6
@@ -176,12 +176,21 @@ is_locked(function (exists) {
|
||||
});
|
||||
});
|
||||
} else if (mode == 'update') {
|
||||
db.update_tx_db(settings.coin, stats.last, stats.count, settings.update_timeout, function(){
|
||||
db.update_richlist('received', function(){
|
||||
db.update_richlist('balance', function(){
|
||||
db.get_stats(settings.coin, function(nstats){
|
||||
console.log('update complete (block: %s)', nstats.last);
|
||||
exit();
|
||||
// Lookup the last block index
|
||||
Tx.findOne({}, {blockindex:1}).sort({blockindex:-1}).limit(1).exec(function(err, data){
|
||||
var nLast = stats.last;
|
||||
if (!err && data) {
|
||||
// start from the last block index
|
||||
nLast = data.blockindex;
|
||||
}
|
||||
|
||||
db.update_tx_db(settings.coin, nLast, stats.count, settings.update_timeout, function(){
|
||||
db.update_richlist('received', function(){
|
||||
db.update_richlist('balance', function(){
|
||||
db.get_stats(settings.coin, function(nstats){
|
||||
console.log('update complete (block: %s)', nstats.last);
|
||||
exit();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user