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()
|
t.rollback()
|
||||||
|
|
||||||
proc safeDispose*(t: DbTransaction) {.inline.} =
|
proc safeDispose*(t: DbTransaction) {.inline.} =
|
||||||
if t != nil and t.state == Pending:
|
if (not isNil(t)) and (t.state == Pending):
|
||||||
t.rollback()
|
t.rollback()
|
||||||
|
|
||||||
proc putImpl[T](db: RootRef, key, val: openarray[byte]) =
|
proc putImpl[T](db: RootRef, key, val: openarray[byte]) =
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import
|
import
|
||||||
random, sets, eth/trie/trie_utils as ethUtils,
|
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
|
type
|
||||||
RandGen*[T] = object
|
RandGen*[T] = object
|
||||||
|
@ -29,8 +30,7 @@ proc randString*(len: int): string =
|
||||||
|
|
||||||
proc randBytes*(len: int): Bytes =
|
proc randBytes*(len: int): Bytes =
|
||||||
result = newSeq[byte](len)
|
result = newSeq[byte](len)
|
||||||
for i in 0..<len:
|
discard randomBytes(result[0].addr, len)
|
||||||
result[i] = rand(255).byte
|
|
||||||
|
|
||||||
proc toBytesRange*(str: string): BytesRange =
|
proc toBytesRange*(str: string): BytesRange =
|
||||||
var s: seq[byte]
|
var s: seq[byte]
|
||||||
|
|
Loading…
Reference in New Issue