Fixed spam for block processing

This commit is contained in:
Kevin Froman 2019-04-20 19:31:14 -05:00
parent 2219be9ae3
commit c674e2d281
3 changed files with 2 additions and 4 deletions

View File

@ -579,7 +579,6 @@ class API:
else:
validSig = False
signer = self._core._utils.bytesToStr(bl.signer)
#print(signer, bl.isSigned(), self._core._utils.validatePubKey(signer), bl.isSigner(signer))
if bl.isSigned() and self._core._utils.validatePubKey(signer) and bl.isSigner(signer):
validSig = True
bl.bheader['validSig'] = validSig

View File

@ -157,6 +157,7 @@ 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:
@ -171,7 +172,6 @@ class OnionrUtils:
try:
if len(blockType) <= 10:
self._core.updateBlockInfo(blockHash, 'dataType', blockType)
onionrevents.event('processblocks', data = {'block': myBlock, 'type': blockType, 'signer': signer, 'validSig': valid}, onionr = None)
except TypeError:
logger.warn("Missing block information")
pass

View File

@ -39,13 +39,12 @@ def _processForwardKey(api, myBlock):
if api.get_utils().validatePubKey(key):
peer.addForwardKey(key)
else:
raise onionrexceptions.InvalidPubkey("%s is nota valid pubkey key" % (key,))
raise onionrexceptions.InvalidPubkey("%s is not a valid pubkey key" % (key,))
def on_processblocks(api, data=None):
# Generally fired by utils.
myBlock = api.data['block']
blockType = api.data['type']
# Process specific block types
# forwardKey blocks, add a new forward secrecy key for a peer