Fixed spam for block processing
parent
2219be9ae3
commit
c674e2d281
|
@ -579,7 +579,6 @@ class API:
|
||||||
else:
|
else:
|
||||||
validSig = False
|
validSig = False
|
||||||
signer = self._core._utils.bytesToStr(bl.signer)
|
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):
|
if bl.isSigned() and self._core._utils.validatePubKey(signer) and bl.isSigner(signer):
|
||||||
validSig = True
|
validSig = True
|
||||||
bl.bheader['validSig'] = validSig
|
bl.bheader['validSig'] = validSig
|
||||||
|
|
|
@ -157,6 +157,7 @@ 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:
|
||||||
|
@ -171,7 +172,6 @@ class OnionrUtils:
|
||||||
try:
|
try:
|
||||||
if len(blockType) <= 10:
|
if len(blockType) <= 10:
|
||||||
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)
|
|
||||||
except TypeError:
|
except TypeError:
|
||||||
logger.warn("Missing block information")
|
logger.warn("Missing block information")
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -39,13 +39,12 @@ def _processForwardKey(api, myBlock):
|
||||||
if api.get_utils().validatePubKey(key):
|
if api.get_utils().validatePubKey(key):
|
||||||
peer.addForwardKey(key)
|
peer.addForwardKey(key)
|
||||||
else:
|
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):
|
def on_processblocks(api, data=None):
|
||||||
# Generally fired by utils.
|
# Generally fired by utils.
|
||||||
myBlock = api.data['block']
|
myBlock = api.data['block']
|
||||||
blockType = api.data['type']
|
blockType = api.data['type']
|
||||||
|
|
||||||
# Process specific block types
|
# Process specific block types
|
||||||
|
|
||||||
# forwardKey blocks, add a new forward secrecy key for a peer
|
# forwardKey blocks, add a new forward secrecy key for a peer
|
||||||
|
|
Loading…
Reference in New Issue