fix some bytes for uploading
This commit is contained in:
parent
2ba42ba145
commit
742ef564e1
@ -77,7 +77,7 @@ def download_blocks_from_communicator(comm_inst):
|
||||
except AttributeError:
|
||||
pass
|
||||
if realHash == blockHash:
|
||||
content = content.decode() # decode here because sha3Hash needs bytes above
|
||||
#content = content.decode() # decode here because sha3Hash needs bytes above
|
||||
metas = blockmetadata.get_block_metadata_from_data(content) # returns tuple(metadata, meta), meta is also in metadata
|
||||
metadata = metas[0]
|
||||
if validatemetadata.validate_metadata(metadata, metas[2]): # check if metadata is valid, and verify nonce
|
||||
|
@ -47,6 +47,9 @@ def lookup_new_peer_transports_with_communicator(comm_inst):
|
||||
# avoid adding if its our address
|
||||
invalid.append(x)
|
||||
for x in invalid:
|
||||
try:
|
||||
newPeers.remove(x)
|
||||
except ValueError:
|
||||
pass
|
||||
comm_inst.newPeers.extend(newPeers)
|
||||
comm_inst.decrementThreadCount('lookup_new_peer_transports_with_communicator')
|
@ -72,8 +72,8 @@ class Block:
|
||||
try:
|
||||
try:
|
||||
self.bcontent = encryption.pub_key_decrypt(self.bcontent, encodedData=encodedData)
|
||||
except binascii.Error:
|
||||
self.bcontent = encryption.pub_key_decrypt(self.bcontent, encodedData=not encodedData)
|
||||
except (binascii.Error, ValueError) as e:
|
||||
self.bcontent = encryption.pub_key_decrypt(self.bcontent, encodedData=False)
|
||||
bmeta = encryption.pub_key_decrypt(self.bmetadata, encodedData=encodedData)
|
||||
try:
|
||||
bmeta = bmeta.decode()
|
||||
|
@ -1,5 +1,6 @@
|
||||
from .. import hashers
|
||||
import config, onionrproofs, logger
|
||||
import onionrexceptions
|
||||
def verify_POW(blockContent):
|
||||
'''
|
||||
Verifies the proof of work associated with a block
|
||||
@ -31,6 +32,7 @@ def verify_POW(blockContent):
|
||||
retData = True
|
||||
else:
|
||||
logger.debug("Invalid token, bad proof")
|
||||
raise onionrexceptions.InvalidProof('Proof for %s needs to be %s' % (blockHash, puzzle))
|
||||
|
||||
return retData
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user