Browse Source

JSON results are returned with HTTP status 500

master
Neil Booth 8 years ago
parent
commit
5abe4faa8d
  1. 2
      server/controller.py
  2. 5
      server/daemon.py

2
server/controller.py

@ -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

5
server/daemon.py

@ -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…
Cancel
Save