mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-03 07:45:18 +00:00
Use ByteList.init instead of List 2048 (#876)
This commit is contained in:
parent
4b498356fc
commit
92dfb02ad7
@ -50,7 +50,7 @@ func fromSszBytes*(T: type ContentType, data: openArray[byte]):
|
||||
contentType
|
||||
|
||||
func encode*(contentKey: ContentKey): ByteList =
|
||||
List.init(SSZ.encode(contentKey), 2048)
|
||||
ByteList.init(SSZ.encode(contentKey))
|
||||
|
||||
func decode*(contentKey: ByteList): Option[ContentKey] =
|
||||
try:
|
||||
|
@ -62,7 +62,7 @@ func fromSszBytes*(T: type ContentType, data: openArray[byte]):
|
||||
contentType
|
||||
|
||||
func encode*(contentKey: ContentKey): ByteList =
|
||||
List.init(SSZ.encode(contentKey), 2048)
|
||||
ByteList.init(SSZ.encode(contentKey))
|
||||
|
||||
# TODO consider if more powerfull error handling is necessary here.
|
||||
func decode*(contentKey: ByteList): Option[ContentKey] =
|
||||
|
@ -111,8 +111,7 @@ suite "Portal Wire Protocol Message Encodings":
|
||||
|
||||
test "FindContent Request":
|
||||
let
|
||||
contentEncoded: ByteList = List.init(@[1'u8], 2048)
|
||||
|
||||
contentEncoded = ByteList.init(@[1'u8])
|
||||
fn = FindContentMessage(contentKey: contentEncoded)
|
||||
|
||||
let encoded = encodeMessage(fn)
|
||||
|
@ -123,7 +123,7 @@ procSuite "Portal Wire Protocol Tests":
|
||||
# table.
|
||||
test.proto2.start()
|
||||
|
||||
let contentKey = List.init(@[1'u8], 2048)
|
||||
let contentKey = ByteList.init(@[1'u8])
|
||||
|
||||
# content does not exist so this should provide us with the closest nodes
|
||||
# to the content, which is the only node in the routing table.
|
||||
|
@ -221,7 +221,7 @@ proc run(config: DiscoveryConf) =
|
||||
key
|
||||
|
||||
# For now just some random bytes
|
||||
let contentKey = List.init(@[1'u8], 2048)
|
||||
let contentKey = ByteList.init(@[1'u8])
|
||||
|
||||
let foundContent = waitFor portal.findContent(config.findContentTarget,
|
||||
contentKey)
|
||||
|
Loading…
x
Reference in New Issue
Block a user