accept FILTERING_CHANNEL_IDS and BLOCKING_CHANNEL_IDS env vars as the old SDK

This commit is contained in:
Victor Shyba 2020-11-05 22:56:13 -03:00 committed by Lex Berezhny
parent e4449d2ec7
commit 9c269c90bb

View file

@ -1,6 +1,7 @@
import os import os
import asyncio import asyncio
import logging import logging
from binascii import unhexlify
from typing import Optional, Tuple, Set, List, Coroutine from typing import Optional, Tuple, Set, List, Coroutine
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
@ -53,8 +54,12 @@ class BlockchainSync(Sync):
self.block_hash_event = asyncio.Event() self.block_hash_event = asyncio.Event()
self.tx_hash_event = asyncio.Event() self.tx_hash_event = asyncio.Event()
self.mempool = [] self.mempool = []
self.filtering_channel_hashes = set() self.filtering_channel_hashes = {
self.blocking_channel_hashes = set() unhexlify(channel_id)[::-1] for channel_id in
os.getenv('FILTERING_CHANNEL_IDS', '').split(' ') if channel_id}
self.blocking_channel_hashes = {
unhexlify(channel_id)[::-1] for channel_id in
os.getenv('BLOCKING_CHANNEL_IDS', '').split(' ') if channel_id}
async def wait_for_chain_ready(self): async def wait_for_chain_ready(self):
while True: while True: