Skip to content

Commit

Permalink
address cheatfate comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jangko authored and zah committed Feb 18, 2019
1 parent c36b3e5 commit daafd99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion eth/trie/db.nim
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ proc dispose*(t: DbTransaction) {.inline.} =
t.rollback()

proc safeDispose*(t: DbTransaction) {.inline.} =
if t != nil and t.state == Pending:
if (not isNil(t)) and (t.state == Pending):
t.rollback()

proc putImpl[T](db: RootRef, key, val: openarray[byte]) =
Expand Down
6 changes: 3 additions & 3 deletions tests/trie/testutils.nim
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import
random, sets, eth/trie/trie_utils as ethUtils,
eth/rlp/types as rlpTypes, ranges/bitranges, nimcrypto/utils
eth/rlp/types as rlpTypes, ranges/bitranges,
nimcrypto/[utils, sysrand]

type
RandGen*[T] = object
Expand Down Expand Up @@ -29,8 +30,7 @@ proc randString*(len: int): string =

proc randBytes*(len: int): Bytes =
result = newSeq[byte](len)
for i in 0..<len:
result[i] = rand(255).byte
discard randomBytes(result[0].addr, len)

proc toBytesRange*(str: string): BytesRange =
var s: seq[byte]
Expand Down

0 comments on commit daafd99

Please sign in to comment.