From 98d8571ceb44daa2563528d28c23d21c339952c3 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Mon, 10 May 2021 11:49:33 +0200 Subject: [PATCH] Simplify --- dagger/bitswap/protobuf/presence.nim | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dagger/bitswap/protobuf/presence.nim b/dagger/bitswap/protobuf/presence.nim index 682ca9aa..af8a4fb7 100644 --- a/dagger/bitswap/protobuf/presence.nim +++ b/dagger/bitswap/protobuf/presence.nim @@ -31,14 +31,12 @@ func parse(_: type UInt256, bytes: seq[byte]): ?UInt256 = UInt256.fromBytesBE(bytes).some func init*(_: type Presence, message: PresenceMessage): ?Presence = - without parsedCid =? Cid.init(message.cid): - return none Presence - - without parsedPrice =? UInt256.parse(message.price): + without cid =? Cid.init(message.cid) and + price =? UInt256.parse(message.price): return none Presence some Presence( - cid: parsedCid, + cid: cid, have: message.`type` == presenceHave, - price: parsedPrice + price: price )