mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-19 08:01:22 +00:00
use floor division
This commit is contained in:
@ -56,7 +56,7 @@ class CounterAppContext():
|
|||||||
return "", 0
|
return "", 0
|
||||||
h = encode_big_endian(self.txCount, 8)
|
h = encode_big_endian(self.txCount, 8)
|
||||||
h.reverse()
|
h.reverse()
|
||||||
return str(h), 0
|
return h.decode(), 0
|
||||||
|
|
||||||
def commit(self):
|
def commit(self):
|
||||||
self.commitCount += 1
|
self.commitCount += 1
|
||||||
|
@ -165,9 +165,7 @@ class TMSPServer():
|
|||||||
self.handle_conn_closed(r)
|
self.handle_conn_closed(r)
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
import sys
|
logger.exception("error reading from connection")
|
||||||
print(sys.exc_info()[0])
|
|
||||||
print("error reading from connection", str(e))
|
|
||||||
self.handle_conn_closed(r)
|
self.handle_conn_closed(r)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ def uvarint_size(i):
|
|||||||
def encode_big_endian(i, size):
|
def encode_big_endian(i, size):
|
||||||
if size == 0:
|
if size == 0:
|
||||||
return bytearray()
|
return bytearray()
|
||||||
return encode_big_endian(i / 256, size - 1) + bytearray([i % 256])
|
return encode_big_endian(i // 256, size - 1) + bytearray([i % 256])
|
||||||
|
|
||||||
|
|
||||||
def decode_big_endian(reader, size):
|
def decode_big_endian(reader, size):
|
||||||
|
Reference in New Issue
Block a user