From 892e9524e503be2c7cb39ca8095a9b4b7fee66f5 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Thu, 3 Nov 2016 11:40:17 +0900 Subject: [PATCH] Fix bugs handling client UTXO requests Allow strings for ints - Electrum command line doesn't convert Don't blow away hash168s from the DB --- server/block_processor.py | 3 ++- server/cache.py | 10 ++++++---- server/protocol.py | 10 ++++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/server/block_processor.py b/server/block_processor.py index 6c9483f..3887204 100644 --- a/server/block_processor.py +++ b/server/block_processor.py @@ -767,7 +767,8 @@ class BlockProcessor(LoggedClass): '''Returns the hash168 for a UTXO.''' hash168 = None if 0 <= index <= 65535: - hash168 = self.utxo_cache(tx_hash, struct.pack('= 0: - return param + try: + param = int(param) + except ValueError: + pass + else: + if param >= 0: + return param + raise RPCError('param should be a non-negative integer: {}' .format(param))