added deleted blocks to statistics command

master
KF 2019-11-09 20:30:07 -06:00
parent 348904c97a
commit 57e750a15a
2 changed files with 5 additions and 1 deletions

View File

@ -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)
keydb.addkeys.add_address(i)

View File

@ -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)) + '%'
}