+ blocks can now be blacklisted

* Peers sync a little better
This commit is contained in:
Kevin Froman 2018-08-11 00:23:59 -05:00
parent 12d39393b4
commit 5f21d15cdd
No known key found for this signature in database
GPG key ID: 0D414D0FE405B63B
4 changed files with 18 additions and 10 deletions

View file

@ -232,6 +232,7 @@ class Onionr:
'listconn': 'list connected peers',
'kex': 'exchange keys with peers (done automatically)',
'pex': 'exchange addresses with peers (done automatically)',
'blacklist-block': 'deletes a block by hash and permanently removes it from your node',
'introduce': 'Introduce your node to the public Onionr network',
}
@ -264,15 +265,22 @@ class Onionr:
try:
ban = sys.argv[2]
except IndexError:
while True:
ban = logger.readline('Enter a block hash:')
if self.onionrUtils.validateHash(ban):
if not self.onionrCore._blacklist.inBlacklist(ban):
self.onionrCore._blacklist.addToDB(ban)
ban = logger.readline('Enter a block hash:')
if self.onionrUtils.validateHash(ban):
if not self.onionrCore._blacklist.inBlacklist(ban):
try:
self.onionrCore._blacklist.addToDB(ban)
self.onionrCore.removeBlock(ban)
except Exception as error:
logger.error('Could not blacklist block', error=error)
else:
logger.info('Block blacklisted')
else:
logger.warn('That block is already blacklisted')
else:
logger.error('Invalid block hash')
return
def listConn(self):
self.onionrCore.daemonQueueAdd('connectedPeers')