mirror of https://github.com/status-im/nim-eth.git
address cheatfate comments
This commit is contained in:
parent
c36b3e54cc
commit
daafd991d5
|
@ -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]) =
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue