fixed dumb print leftover spamming hashes

This commit is contained in:
Kevin Froman 2019-04-22 21:02:09 -05:00
parent c674e2d281
commit 71aadb7767
8 changed files with 15 additions and 13 deletions

View File

@ -114,10 +114,11 @@ class PublicAPI:
# Provide a list of our blocks, with a date offset
dateAdjust = request.args.get('date')
bList = clientAPI._core.getBlockList(dateRec=dateAdjust)
for b in self.hideBlocks:
if b in bList:
# Don't share blocks we created if they haven't been *uploaded* yet, makes it harder to find who created a block
bList.remove(b)
if config.get('general.hide_created_blocks', True):
for b in self.hideBlocks:
if b in bList:
# Don't share blocks we created if they haven't been *uploaded* yet, makes it harder to find who created a block
bList.remove(b)
return Response('\n'.join(bList))
@app.route('/getdata/<name>')
@ -126,7 +127,7 @@ class PublicAPI:
resp = ''
data = name
if clientAPI._utils.validateHash(data):
if data not in self.hideBlocks:
if not config.get('general.hide_created_blocks', True) or data not in self.hideBlocks:
if data in clientAPI._core.getBlockList():
block = clientAPI.getBlockData(data, raw=True)
try:
@ -244,7 +245,7 @@ class API:
'''
Initialize the api server, preping variables for later use
This initilization defines all of the API entry points and handlers for the endpoints and errors
This initialization defines all of the API entry points and handlers for the endpoints and errors
This also saves the used host (random localhost IP address) to the data folder in host.txt
'''

View File

@ -621,7 +621,7 @@ class OnionrCommunicatorDaemon:
def detectAPICrash(self):
'''exit if the api server crashes/stops'''
if self._core._utils.localCommand('ping', silent=False) not in ('pong', 'pong!'):
for i in range(12):
for i in range(20):
if self._core._utils.localCommand('ping') in ('pong', 'pong!') or self.shutdown:
break # break for loop
time.sleep(1)

View File

@ -692,7 +692,7 @@ class Core:
createTime = self._utils.getRoundedEpoch()
# check nonce
print(data)
#print(data)
dataNonce = self._utils.bytesToStr(self._crypto.sha3Hash(data))
try:
with open(self.dataNonceFile, 'r') as nonces:

View File

@ -260,6 +260,8 @@ def check():
if not os.path.exists(os.path.dirname(get_plugins_folder())):
logger.debug('Generating plugin data folder...')
os.makedirs(os.path.dirname(get_plugins_folder()))
try:
os.makedirs(os.path.dirname(get_plugins_folder()))
except FileExistsError:
pass
return

View File

@ -259,7 +259,6 @@ class POW:
self.hashing = False
iFound = True
self.result = payload
print('count', nonce - startNonce)
break
nonce += 1

View File

@ -157,7 +157,6 @@ class OnionrUtils:
'''
Read metadata from a block and cache it to the block database
'''
onionrevents.event('processblocks', data = {'block': myBlock, 'type': blockType, 'signer': signer, 'validSig': valid}, onionr = None)
curTime = self.getRoundedEpoch(roundS=60)
myBlock = Block(blockHash, self._core)
if myBlock.isEncrypted:
@ -185,6 +184,7 @@ class OnionrUtils:
self._core.updateBlockInfo(blockHash, 'expire', expireTime)
if not blockType is None:
self._core.updateBlockInfo(blockHash, 'dataType', blockType)
onionrevents.event('processblocks', data = {'block': myBlock, 'type': blockType, 'signer': signer, 'validSig': valid}, onionr = None)
else:
pass
#logger.debug('Not processing metadata on encrypted block we cannot decrypt.')

View File

@ -1 +0,0 @@
ecaufnpxx67xmvzwcriohapmmnqbj665h3ynemvwrr2juxl5oa5g7cad.onion

View File

@ -6,6 +6,7 @@
"minimum_send_pow": 4,
"socket_servers": false,
"security_level": 0,
"hide_created_blocks": true,
"max_block_age": 2678400,
"bypass_tor_check": false,
"public_key": "",