@@ -101,23 +101,18 @@ proc eth_blockNumber(ctx: ptr Context, cb: CallBackProc) {.exported.} =
101101 fut.addCallback proc (_: pointer ) {.gcsafe .} =
102102 try :
103103 ctx.lock.acquire ()
104- if fut.cancelled:
105- task.response = " { \" error\" : \" cancelled \" } "
104+ if fut.cancelled () :
105+ task.response = Json . encode (fut. error ())
106106 task.finished = true
107107 task.status = - 2
108108 elif fut.failed ():
109- task.response = " { \" error\" : \" failed \" } "
109+ task.response = Json . encode (fut. error ())
110110 task.finished = true
111111 task.status = - 1
112112 else :
113- try :
114- task.response = Json .encode (fut.read ())
115- task.status = 0
116- except CatchableError as e:
117- task.response = " {\" error\" : \" " & e.msg & " \" }"
118- task.status = - 1
119- finally :
120- task.finished = true
113+ task.response = Json .encode (fut.value ())
114+ task.status = 0
115+ task.finished = true
121116 finally :
122117 ctx.lock.release ()
123118
@@ -203,7 +198,7 @@ proc run(ctx: ptr Context, configJson: string) {.async: (raises: [ValueError, Ca
203198 engine = RpcVerificationEngine .init (engineConf)
204199 jsonRpcClient = JsonRpcClient .init (config.backendUrl)
205200
206- # the backend only needs the url to connect to
201+ # the backend only needs the url to connect to
207202 engine.backend = jsonRpcClient.getEthApiBackend ()
208203
209204 # inject the frontend into c context
@@ -213,8 +208,8 @@ proc run(ctx: ptr Context, configJson: string) {.async: (raises: [ValueError, Ca
213208 var status = await jsonRpcClient.start ()
214209 if status.isErr ():
215210 raise newException (ValueError , status.error)
216-
217- await startLightClient (config, engine)
211+ # FIXME: throws illegal storage access SEGFAULT when used as a library but not when run as a nim program.
212+ # await startLightClient(config, engine)
218213
219214proc startVerifProxy (ctx: ptr Context , configJson: cstring , cb: CallBackProc ) {.exported .} =
220215 try :
0 commit comments