Browse Source

Merge branch 'no_memview' into develop

master
Neil Booth 8 years ago
parent
commit
dfaaa465ee
  1. 6
      server/db.py
  2. 2
      server/server.py

6
server/db.py

@ -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

2
server/server.py

@ -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

Loading…
Cancel
Save