JSON results are returned with HTTP status 500
This commit is contained in:
parent
c958b3af49
commit
5abe4faa8d
@ -22,7 +22,7 @@ from lib.jsonrpc import JSONRPC, RPCError, RequestBase
|
|||||||
from lib.hash import sha256, double_sha256, hash_to_str, hex_str_to_hash
|
from lib.hash import sha256, double_sha256, hash_to_str, hex_str_to_hash
|
||||||
import lib.util as util
|
import lib.util as util
|
||||||
from server.block_processor import BlockProcessor
|
from server.block_processor import BlockProcessor
|
||||||
from server.daemon import Daemon
|
from server.daemon import Daemon, DaemonError
|
||||||
from server.irc import IRC
|
from server.irc import IRC
|
||||||
from server.session import LocalRPC, ElectrumX
|
from server.session import LocalRPC, ElectrumX
|
||||||
from server.mempool import MemPool
|
from server.mempool import MemPool
|
||||||
|
|||||||
@ -70,7 +70,10 @@ class Daemon(util.LoggedClass):
|
|||||||
async with self.workqueue_semaphore:
|
async with self.workqueue_semaphore:
|
||||||
url = self.urls[self.url_index]
|
url = self.urls[self.url_index]
|
||||||
async with aiohttp.post(url, data=data) as resp:
|
async with aiohttp.post(url, data=data) as resp:
|
||||||
if resp.status == 200:
|
# If bitcoind can't find a tx, for some reason
|
||||||
|
# it returns 500 but fills out the JSON.
|
||||||
|
# Should still return 200 IMO.
|
||||||
|
if resp.status in (200, 500):
|
||||||
if self.prior_msg:
|
if self.prior_msg:
|
||||||
self.logger.info('connection restored')
|
self.logger.info('connection restored')
|
||||||
result = processor(await resp.json())
|
result = processor(await resp.json())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user