address cheatfate comments

This commit is contained in:
andri lim 2019-02-18 16:48:26 +07:00 committed by zah
parent c36b3e54cc
commit daafd991d5
2 changed files with 4 additions and 4 deletions

View File

@ -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]) =

View File

@ -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
@ -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]