1
0

fix most "scripts"

related: #4754
This commit is contained in:
SomberNight
2018-11-02 20:14:59 +01:00
parent 5c4a6c0f2b
commit e37da62a1c
15 changed files with 266 additions and 194 deletions

View File

@@ -31,7 +31,7 @@ from aiorpcx import TaskGroup, run_in_thread
from .transaction import Transaction
from .util import bh2u, make_aiohttp_session, NetworkJobOnDefaultServer
from .bitcoin import address_to_scripthash
from .bitcoin import address_to_scripthash, is_address
if TYPE_CHECKING:
from .network import Network
@@ -77,7 +77,8 @@ class SynchronizerBase(NetworkJobOnDefaultServer):
def add(self, addr):
asyncio.run_coroutine_threadsafe(self._add_address(addr), self.asyncio_loop)
async def _add_address(self, addr):
async def _add_address(self, addr: str):
if not is_address(addr): raise ValueError(f"invalid bitcoin address {addr}")
if addr in self.requested_addrs: return
self.requested_addrs.add(addr)
await self.add_queue.put(addr)