Merge branch 'no_memview' into develop

This commit is contained in:
Neil Booth 2016-10-16 09:09:43 +09:00
commit dfaaa465ee
2 changed files with 3 additions and 5 deletions

View File

@ -128,9 +128,7 @@ class UTXOCache(object):
# self.logger.info('duplicate tx hash {}'
# .format(bytes(reversed(tx_hash)).hex()))
# b''.join avoids this: https://bugs.python.org/issue13298
self.cache[key] = b''.join(
(hash168, tx_numb, pack('<Q', txout.value)))
self.cache[key] = hash168 + tx_numb + pack('<Q', txout.value)
return hash168s
@ -141,7 +139,7 @@ class UTXOCache(object):
'''
# Fast track is it's in the cache
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)
if value:
self.cache_hits += 1

View File

@ -136,7 +136,7 @@ class BlockCache(object):
blocks = await self.send_vector('getblock', param_lists)
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]
# Reverse order and place at front of list
self.blocks = list(reversed(blocks)) + self.blocks