mirror of https://github.com/status-im/nim-eth.git
Minor improvements from pr comments (#455)
This commit is contained in:
parent
42e257796f
commit
664072fff7
|
@ -168,7 +168,7 @@ proc decodePacket*(bytes: openArray[byte]): Result[Packet, string] =
|
||||||
if (receivedBytesLength == minimalHeaderSize):
|
if (receivedBytesLength == minimalHeaderSize):
|
||||||
@[]
|
@[]
|
||||||
else:
|
else:
|
||||||
bytes[20..^1]
|
bytes[minimalHeaderSize..^1]
|
||||||
|
|
||||||
return ok(Packet(header: header, eack: none[SelectiveAckExtension](), payload: payload))
|
return ok(Packet(header: header, eack: none[SelectiveAckExtension](), payload: payload))
|
||||||
else:
|
else:
|
||||||
|
@ -189,14 +189,14 @@ proc decodePacket*(bytes: openArray[byte]): Result[Packet, string] =
|
||||||
|
|
||||||
|
|
||||||
let extension = SelectiveAckExtension(
|
let extension = SelectiveAckExtension(
|
||||||
acks: [bytes[22], bytes[23], bytes[24], bytes[25]]
|
acks: toArray(4, bytes.toOpenArray(22, 25))
|
||||||
)
|
)
|
||||||
|
|
||||||
let payload =
|
let payload =
|
||||||
if (receivedBytesLength == minimalHeaderSizeWithSelectiveAck):
|
if (receivedBytesLength == minimalHeaderSizeWithSelectiveAck):
|
||||||
@[]
|
@[]
|
||||||
else:
|
else:
|
||||||
bytes[26..^1]
|
bytes[minimalHeaderSizeWithSelectiveAck..^1]
|
||||||
|
|
||||||
return ok(Packet(header: header, eack: some(extension), payload: payload))
|
return ok(Packet(header: header, eack: some(extension), payload: payload))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue