mirror of https://github.com/status-im/nim-eth.git
parent
7c709551a5
commit
e9b25b5309
|
@ -4,7 +4,7 @@ description = "Ethereum Common library"
|
|||
license = "MIT"
|
||||
skipDirs = @["tests"]
|
||||
|
||||
requires "nim >= 0.19.0",
|
||||
requires "nim >= 1.2.0",
|
||||
"nimcrypto",
|
||||
"stint",
|
||||
"secp256k1",
|
||||
|
|
|
@ -13,7 +13,7 @@ const maxOpenFiles = 512
|
|||
|
||||
proc get*(db: ChainDB, key: openarray[byte]): seq[byte] =
|
||||
let s = db.store.getBytes(key)
|
||||
if s.ok:
|
||||
if s.isOk:
|
||||
result = s.value
|
||||
traceGet key, result
|
||||
elif s.error.len == 0:
|
||||
|
@ -24,17 +24,17 @@ proc get*(db: ChainDB, key: openarray[byte]): seq[byte] =
|
|||
proc put*(db: ChainDB, key, value: openarray[byte]) =
|
||||
tracePut key, value
|
||||
let s = db.store.put(key, value)
|
||||
if not s.ok: raiseKeyWriteError(key)
|
||||
if not s.isOk: raiseKeyWriteError(key)
|
||||
|
||||
proc contains*(db: ChainDB, key: openarray[byte]): bool =
|
||||
let s = db.store.contains(key)
|
||||
if not s.ok: raiseKeySearchError(key)
|
||||
if not s.isOk: raiseKeySearchError(key)
|
||||
return s.value
|
||||
|
||||
proc del*(db: ChainDB, key: openarray[byte]) =
|
||||
traceDel key
|
||||
let s = db.store.del(key)
|
||||
if not s.ok: raiseKeyDeletionError(key)
|
||||
if not s.isOk: raiseKeyDeletionError(key)
|
||||
|
||||
proc close*(db: ChainDB) =
|
||||
db.store.close
|
||||
|
@ -50,7 +50,7 @@ proc newChainDB*(basePath: string, readOnly = false): ChainDB =
|
|||
|
||||
let s = result.store.init(dataDir, backupsDir, readOnly,
|
||||
maxOpenFiles = maxOpenFiles)
|
||||
if not s.ok: raiseStorageInitError()
|
||||
if not s.isOk: raiseStorageInitError()
|
||||
|
||||
if not readOnly:
|
||||
put(result, emptyRlpHash.data, emptyRlp)
|
||||
|
|
Loading…
Reference in New Issue