connector
This commit is contained in:
parent
4004af4b34
commit
bc6c422e6d
@ -219,6 +219,7 @@ class Worker:
|
|||||||
|
|
||||||
async def load_blocks(self, height):
|
async def load_blocks(self, height):
|
||||||
try:
|
try:
|
||||||
|
attempt = 10
|
||||||
t = 0
|
t = 0
|
||||||
start_height = height
|
start_height = height
|
||||||
batch = list()
|
batch = list()
|
||||||
@ -237,7 +238,15 @@ class Worker:
|
|||||||
if r["result"] is not None:
|
if r["result"] is not None:
|
||||||
batch.append(["getblock", r["result"], 0])
|
batch.append(["getblock", r["result"], 0])
|
||||||
h.append(lh)
|
h.append(lh)
|
||||||
result = await self.rpc.batch(batch)
|
while True:
|
||||||
|
try:
|
||||||
|
result = await self.rpc.batch(batch)
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
await asyncio.sleep(5)
|
||||||
|
attempt -= 1
|
||||||
|
if not attempt:
|
||||||
|
raise RuntimeError("Connect to bitcoind failed")
|
||||||
blocks = dict()
|
blocks = dict()
|
||||||
|
|
||||||
for x, y in zip(h, result):
|
for x, y in zip(h, result):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user