cosmetics changes

This commit is contained in:
andri lim 2018-11-03 08:23:39 +07:00 committed by zah
parent f590bf0154
commit 21105f1558
2 changed files with 2 additions and 5 deletions

View File

@ -19,7 +19,7 @@ requires "nim > 0.18.0",
"asyncdispatch2",
"eth_common",
"package_visible_types",
"https://github.com/jangko/snappy"
"snappy"
proc runTest(name: string, defs = "", lang = "c") =
exec "nim " & lang & " " & defs & " -d:testing --experimental:ForLoopMacros -r tests/" & name

View File

@ -423,15 +423,12 @@ proc recvMsg*(peer: Peer): Future[tuple[msgId: int, msgData: Rlp]] {.async.} =
decryptedBytes.setLen(decryptedBytesCount)
when defined(useSnappy):
var rlp: Rlp
if peer.network.protocolVersion == devp2pSnappyVersion:
decryptedBytes = snappy.uncompress(decryptedBytes)
if decryptedBytes.len == 0:
await peer.disconnectAndRaise(BreachOfProtocol,
"Snappy uncompress encountered malformed data")
rlp = rlpFromBytes(decryptedBytes.toRange)
else:
var rlp = rlpFromBytes(decryptedBytes.toRange)
var rlp = rlpFromBytes(decryptedBytes.toRange)
try:
let msgid = rlp.read(int)