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,6 +114,7 @@ class PublicAPI:
# Provide a list of our blocks, with a date offset # Provide a list of our blocks, with a date offset
dateAdjust = request.args.get('date') dateAdjust = request.args.get('date')
bList = clientAPI._core.getBlockList(dateRec=dateAdjust) bList = clientAPI._core.getBlockList(dateRec=dateAdjust)
if config.get('general.hide_created_blocks', True):
for b in self.hideBlocks: for b in self.hideBlocks:
if b in bList: 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 # Don't share blocks we created if they haven't been *uploaded* yet, makes it harder to find who created a block
@ -126,7 +127,7 @@ class PublicAPI:
resp = '' resp = ''
data = name data = name
if clientAPI._utils.validateHash(data): 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(): if data in clientAPI._core.getBlockList():
block = clientAPI.getBlockData(data, raw=True) block = clientAPI.getBlockData(data, raw=True)
try: try:
@ -244,7 +245,7 @@ class API:
''' '''
Initialize the api server, preping variables for later use 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 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): def detectAPICrash(self):
'''exit if the api server crashes/stops''' '''exit if the api server crashes/stops'''
if self._core._utils.localCommand('ping', silent=False) not in ('pong', 'pong!'): 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: if self._core._utils.localCommand('ping') in ('pong', 'pong!') or self.shutdown:
break # break for loop break # break for loop
time.sleep(1) time.sleep(1)

View File

@ -692,7 +692,7 @@ class Core:
createTime = self._utils.getRoundedEpoch() createTime = self._utils.getRoundedEpoch()
# check nonce # check nonce
print(data) #print(data)
dataNonce = self._utils.bytesToStr(self._crypto.sha3Hash(data)) dataNonce = self._utils.bytesToStr(self._crypto.sha3Hash(data))
try: try:
with open(self.dataNonceFile, 'r') as nonces: 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())): if not os.path.exists(os.path.dirname(get_plugins_folder())):
logger.debug('Generating plugin data folder...') logger.debug('Generating plugin data folder...')
try:
os.makedirs(os.path.dirname(get_plugins_folder())) os.makedirs(os.path.dirname(get_plugins_folder()))
except FileExistsError:
pass
return return

View File

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

View File

@ -157,7 +157,6 @@ class OnionrUtils:
''' '''
Read metadata from a block and cache it to the block database 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) curTime = self.getRoundedEpoch(roundS=60)
myBlock = Block(blockHash, self._core) myBlock = Block(blockHash, self._core)
if myBlock.isEncrypted: if myBlock.isEncrypted:
@ -185,6 +184,7 @@ class OnionrUtils:
self._core.updateBlockInfo(blockHash, 'expire', expireTime) self._core.updateBlockInfo(blockHash, 'expire', expireTime)
if not blockType is None: if not blockType is None:
self._core.updateBlockInfo(blockHash, 'dataType', blockType) self._core.updateBlockInfo(blockHash, 'dataType', blockType)
onionrevents.event('processblocks', data = {'block': myBlock, 'type': blockType, 'signer': signer, 'validSig': valid}, onionr = None)
else: else:
pass pass
#logger.debug('Not processing metadata on encrypted block we cannot decrypt.') #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, "minimum_send_pow": 4,
"socket_servers": false, "socket_servers": false,
"security_level": 0, "security_level": 0,
"hide_created_blocks": true,
"max_block_age": 2678400, "max_block_age": 2678400,
"bypass_tor_check": false, "bypass_tor_check": false,
"public_key": "", "public_key": "",