Full address history with DataTables ajax loading
This commit is contained in:
+44
-41
@@ -1,11 +1,12 @@
|
||||
var mongoose = require('mongoose')
|
||||
, db = require('../lib/database')
|
||||
, Tx = require('../models/tx')
|
||||
, Address = require('../models/address')
|
||||
, Richlist = require('../models/richlist')
|
||||
, Stats = require('../models/stats')
|
||||
, settings = require('../lib/settings')
|
||||
, fs = require('fs');
|
||||
, db = require('../lib/database')
|
||||
, Tx = require('../models/tx')
|
||||
, Address = require('../models/address')
|
||||
, AddressTx = require('../models/addresstx')
|
||||
, Richlist = require('../models/richlist')
|
||||
, Stats = require('../models/stats')
|
||||
, settings = require('../lib/settings')
|
||||
, fs = require('fs');
|
||||
|
||||
var mode = 'update';
|
||||
var database = 'index';
|
||||
@@ -23,10 +24,10 @@ function usage() {
|
||||
console.log('check checks index for (and adds) any missing transactions/addresses');
|
||||
console.log('reindex Clears index then resyncs from genesis to current block');
|
||||
console.log('');
|
||||
console.log('notes:');
|
||||
console.log('notes:');
|
||||
console.log('* \'current block\' is the latest created block when script is executed.');
|
||||
console.log('* The market database only supports (& defaults to) reindex mode.');
|
||||
console.log('* If check mode finds missing data(ignoring new data since last sync),');
|
||||
console.log('* If check mode finds missing data(ignoring new data since last sync),');
|
||||
console.log(' index_timeout in settings.json is set too low.')
|
||||
console.log('');
|
||||
process.exit(0);
|
||||
@@ -39,17 +40,17 @@ if (process.argv[2] == 'index') {
|
||||
} else {
|
||||
switch(process.argv[3])
|
||||
{
|
||||
case 'update':
|
||||
mode = 'update';
|
||||
break;
|
||||
case 'check':
|
||||
mode = 'check';
|
||||
break;
|
||||
case 'reindex':
|
||||
mode = 'reindex';
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
case 'update':
|
||||
mode = 'update';
|
||||
break;
|
||||
case 'check':
|
||||
mode = 'check';
|
||||
break;
|
||||
case 'reindex':
|
||||
mode = 'reindex';
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
} else if (process.argv[2] == 'market'){
|
||||
@@ -87,7 +88,7 @@ function remove_lock(cb) {
|
||||
});
|
||||
} else {
|
||||
return cb();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function is_locked(cb) {
|
||||
@@ -102,7 +103,7 @@ function is_locked(cb) {
|
||||
});
|
||||
} else {
|
||||
return cb();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function exit() {
|
||||
@@ -140,34 +141,36 @@ is_locked(function (exists) {
|
||||
db.get_stats(settings.coin, function(stats){
|
||||
if (settings.heavy == true) {
|
||||
db.update_heavy(settings.coin, stats.count, 20, function(){
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
if (mode == 'reindex') {
|
||||
Tx.remove({}, function(err) {
|
||||
Address.remove({}, function(err2) {
|
||||
Richlist.updateOne({coin: settings.coin}, {
|
||||
received: [],
|
||||
balance: [],
|
||||
}, function(err3) {
|
||||
Stats.updateOne({coin: settings.coin}, {
|
||||
last: 0,
|
||||
}, function() {
|
||||
console.log('index cleared (reindex)');
|
||||
});
|
||||
db.update_tx_db(settings.coin, 1, 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('reindex complete (block: %s)', nstats.last);
|
||||
exit();
|
||||
Tx.remove({}, function(err) {
|
||||
Address.remove({}, function(err2) {
|
||||
AddressTx.remove({}, function(err3) {
|
||||
Richlist.updateOne({coin: settings.coin}, {
|
||||
received: [],
|
||||
balance: [],
|
||||
}, function(err3) {
|
||||
Stats.updateOne({coin: settings.coin}, {
|
||||
last: 0,
|
||||
}, function() {
|
||||
console.log('index cleared (reindex)');
|
||||
});
|
||||
db.update_tx_db(settings.coin, 1, 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('reindex complete (block: %s)', nstats.last);
|
||||
exit();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
} else if (mode == 'check') {
|
||||
db.update_tx_db(settings.coin, 1, stats.count, settings.check_timeout, function(){
|
||||
db.get_stats(settings.coin, function(nstats){
|
||||
|
||||
Reference in New Issue
Block a user