Merge branch 'no_memview' into develop
This commit is contained in:
commit
dfaaa465ee
@ -128,9 +128,7 @@ class UTXOCache(object):
|
|||||||
# self.logger.info('duplicate tx hash {}'
|
# self.logger.info('duplicate tx hash {}'
|
||||||
# .format(bytes(reversed(tx_hash)).hex()))
|
# .format(bytes(reversed(tx_hash)).hex()))
|
||||||
|
|
||||||
# b''.join avoids this: https://bugs.python.org/issue13298
|
self.cache[key] = hash168 + tx_numb + pack('<Q', txout.value)
|
||||||
self.cache[key] = b''.join(
|
|
||||||
(hash168, tx_numb, pack('<Q', txout.value)))
|
|
||||||
|
|
||||||
return hash168s
|
return hash168s
|
||||||
|
|
||||||
@ -141,7 +139,7 @@ class UTXOCache(object):
|
|||||||
'''
|
'''
|
||||||
# Fast track is it's in the cache
|
# Fast track is it's in the cache
|
||||||
pack = struct.pack
|
pack = struct.pack
|
||||||
key = b''.join((prevout.hash, pack('<H', prevout.n)))
|
key = prevout.hash + pack('<H', prevout.n)
|
||||||
value = self.cache.pop(key, None)
|
value = self.cache.pop(key, None)
|
||||||
if value:
|
if value:
|
||||||
self.cache_hits += 1
|
self.cache_hits += 1
|
||||||
|
|||||||
@ -136,7 +136,7 @@ class BlockCache(object):
|
|||||||
blocks = await self.send_vector('getblock', param_lists)
|
blocks = await self.send_vector('getblock', param_lists)
|
||||||
self.fetched_height += count
|
self.fetched_height += count
|
||||||
|
|
||||||
# Convert hex string to bytes and put in memoryview
|
# Convert hex string to bytes
|
||||||
blocks = [bytes.fromhex(block) for block in blocks]
|
blocks = [bytes.fromhex(block) for block in blocks]
|
||||||
# Reverse order and place at front of list
|
# Reverse order and place at front of list
|
||||||
self.blocks = list(reversed(blocks)) + self.blocks
|
self.blocks = list(reversed(blocks)) + self.blocks
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user