Add 2 network charts to page header

-Hashrate chart is populated from get_hashrate
-Difficulty chart is populated from get_difficulty
-Added a networkhistories collection to hold the new network data
-Index sync and resync functions now check for and update network history data at the end of the sync process
-restore_backup.sh and delete_database.sh scripts now drop the new networkhistories collection
-Added a new javascript library chartjs-plugin-crosshair which adds crosshair functionality to the new chart.js line charts
-Added new settings to settings.json for controlling things like collecting network_history data, independently enabling/disabling the network charts and changing colors of various aspects of the charts
-Updated README to introduce the network charts and added a line for the chartjs-plugin-crosshair library
This commit is contained in:
Joe Uhren
2022-04-11 01:37:27 -06:00
parent f4f569a5db
commit aa1765d8d9
11 changed files with 651 additions and 61 deletions
+1
View File
@@ -21,6 +21,7 @@ sudo touch "${SCRIPT_PATH}/del.tmp" && mongo <<EOF
use explorerdb
db.addresses.drop()
db.addresstxes.drop()
db.networkhistories.drop()
db.coinstats.drop()
db.heavies.drop()
db.markets.drop()
+1
View File
@@ -34,6 +34,7 @@ sudo mongo <<EOF
use explorerdb
db.addresses.drop()
db.addresstxes.drop()
db.networkhistories.drop()
db.coinstats.drop()
db.heavies.drop()
db.markets.drop()
+23 -8
View File
@@ -339,11 +339,14 @@ if (database == 'peers') {
db.get_stats(settings.coin.name, function(nstats) {
// check for and update heavycoin data if applicable
update_heavy(settings.coin.name, stats.count, 20, settings.blockchain_specific.heavycoin.enabled, function(heavy) {
// always check for and remove the sync msg if exists
remove_sync_message();
// check for and update network history data if applicable
update_network_history(nstats.last, settings.network_history.enabled, function(network_hist) {
// always check for and remove the sync msg if exists
remove_sync_message();
console.log('reindex complete (block: %s)', nstats.last);
exit();
console.log('reindex complete (block: %s)', nstats.last);
exit();
});
});
});
});
@@ -383,11 +386,14 @@ if (database == 'peers') {
db.get_stats(settings.coin.name, function(nstats) {
// check for and update heavycoin data if applicable
update_heavy(settings.coin.name, stats.count, 20, settings.blockchain_specific.heavycoin.enabled, function(heavy) {
// always check for and remove the sync msg if exists
remove_sync_message();
// check for and update network history data if applicable
update_network_history(nstats.last, settings.network_history.enabled, function(network_hist) {
// always check for and remove the sync msg if exists
remove_sync_message();
console.log('update complete (block: %s)', nstats.last);
exit();
console.log('update complete (block: %s)', nstats.last);
exit();
});
});
});
});
@@ -580,6 +586,15 @@ function update_heavy(coin, height, count, heavycoin_enabled, cb) {
return cb(false);
}
function update_network_history(height, network_history_enabled, cb) {
if (network_history_enabled == true) {
db.update_network_history(height, function() {
return cb(true);
});
} else
return cb(false);
}
function check_show_sync_message(blocks_to_sync) {
var retVal = false;
var filePath = './tmp/show_sync_message.tmp';