From 57e750a15a410e5635a90783879991c71d59b751 Mon Sep 17 00:00:00 2001 From: KF Date: Sat, 9 Nov 2019 20:30:07 -0600 Subject: [PATCH] added deleted blocks to statistics command --- onionr/communicator/bootstrappeers.py | 2 +- onionr/onionrcommands/onionrstatistics.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/onionr/communicator/bootstrappeers.py b/onionr/communicator/bootstrappeers.py index 2207af3a..dab2b3f9 100644 --- a/onionr/communicator/bootstrappeers.py +++ b/onionr/communicator/bootstrappeers.py @@ -28,4 +28,4 @@ def add_bootstrap_list_to_peer_list(comm_inst, peerList, db_only=False): for i in bootstrap_peers: if i not in peerList and i not in comm_inst.offlinePeers and not i in gettransports.get() and len(str(i).strip()) > 0: if not db_only: peerList.append(i) - keydb.addkeys.add_address(i) \ No newline at end of file + keydb.addkeys.add_address(i) diff --git a/onionr/onionrcommands/onionrstatistics.py b/onionr/onionrcommands/onionrstatistics.py index 53d0b980..45154bc2 100755 --- a/onionr/onionrcommands/onionrstatistics.py +++ b/onionr/onionrcommands/onionrstatistics.py @@ -20,6 +20,7 @@ import os, uuid, time import logger from onionrblocks import onionrblockapi +from onionrblocks import onionrblacklist from onionrutils import checkcommunicator, mnemonickeys from utils import sizeutils, gethostname, getconsolewidth, identifyhome from coredb import blockmetadb, daemonqueue, keydb @@ -31,6 +32,8 @@ def show_stats(): totalBlocks = len(blockmetadb.get_block_list()) home = identifyhome.identify_home() signedBlocks = len(onionrblockapi.Block.getBlocks(signed = True)) + totalBanned = len(onionrblacklist.OnionrBlackList().getList()) + messages = { # info about local client 'Onionr Daemon Status' : ((logger.colors.fg.green + 'Online') if checkcommunicator.is_communicator_running(timeout = 9) else logger.colors.fg.red + 'Offline'), @@ -46,6 +49,7 @@ def show_stats(): 'Known Peers (nodes)' : str(max(len(keydb.listkeys.list_adders()) - 1, 0)), 'Enabled Plugins' : str(len(config.get('plugins.enabled', list()))) + ' / ' + str(len(os.listdir(home + 'plugins/'))), 'Stored Blocks' : str(totalBlocks), + 'Deleted Blocks' : str(totalBanned), 'Percent Blocks Signed' : str(round(100 * signedBlocks / max(totalBlocks, 1), 2)) + '%' }