1
0

interface: follow-up 6cc70bc7a2

This commit is contained in:
SomberNight
2019-05-15 19:56:16 +02:00
parent cd52350f5d
commit e8bc5bbec4
2 changed files with 29 additions and 12 deletions

View File

@@ -26,14 +26,16 @@ import asyncio
import hashlib
from typing import Dict, List, TYPE_CHECKING, Tuple
from collections import defaultdict
import logging
from aiorpcx import TaskGroup, run_in_thread
from aiorpcx import TaskGroup, run_in_thread, RPCError
from .transaction import Transaction
from .util import bh2u, make_aiohttp_session, NetworkJobOnDefaultServer
from .bitcoin import address_to_scripthash, is_address
from .network import UntrustedServerReturnedError
from .logging import Logger
from .interface import GracefulDisconnect
if TYPE_CHECKING:
from .network import Network
@@ -103,7 +105,12 @@ class SynchronizerBase(NetworkJobOnDefaultServer):
h = address_to_scripthash(addr)
self.scripthash_to_address[h] = addr
self._requests_sent += 1
await self.session.subscribe('blockchain.scripthash.subscribe', [h], self.status_queue)
try:
await self.session.subscribe('blockchain.scripthash.subscribe', [h], self.status_queue)
except RPCError as e:
if e.message == 'history too large': # no unique error code
raise GracefulDisconnect(e, log_level=logging.ERROR) from e
raise
self._requests_answered += 1
self.requested_addrs.remove(addr)