Corrected type hinting for block queues and peer sets
This commit is contained in:
parent
9ef6f46a5c
commit
be1dde95a6
@ -2,11 +2,11 @@ import threading
|
||||
from time import sleep
|
||||
from typing import TYPE_CHECKING, Set, Tuple
|
||||
from os import urandom
|
||||
import queue
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ordered_set import OrderedSet
|
||||
from onionrblocks import Block
|
||||
from queue import Queue
|
||||
|
||||
from .peer import Peer
|
||||
|
||||
@ -41,8 +41,8 @@ In stem phase, server disables diffusion
|
||||
|
||||
|
||||
def start_gossip_threads(
|
||||
peer_set: OrderedSet['Peer'],
|
||||
block_queues: Tuple[queue.Queue['Block']]):
|
||||
peer_set: "OrderedSet[Peer]",
|
||||
block_queues: Tuple["Queue[Block]"]):
|
||||
# Peer set is largely handled by the transport plugins
|
||||
# There is a unified set so gossip logic is not repeated
|
||||
seed = urandom(32)
|
||||
|
@ -50,8 +50,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
def gossip_client(
|
||||
peer_set: OrderedSet['Peer'],
|
||||
block_queues: Tuple[Queue['Block'], Queue['Block']],
|
||||
peer_set: "OrderedSet[Peer]",
|
||||
block_queues: Tuple["Queue[Block]", "Queue[Block]"],
|
||||
dandelion_seed: bytes):
|
||||
"""
|
||||
Gossip client does the following:
|
||||
|
@ -10,12 +10,12 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
def store_blocks(
|
||||
block_queues: Tuple[Queue['Block'], Queue['Block']],
|
||||
block_queues: Tuple["Queue[Block]", "Queue[Block]"],
|
||||
dandelion_phase: 'DandelionPhase'):
|
||||
|
||||
new_queue: Queue['Block'] = Queue()
|
||||
new_queue: "Queue[Block]" = Queue()
|
||||
|
||||
def _watch_queue(block_queue: Queue['Block']):
|
||||
def _watch_queue(block_queue: "Queue[Block]"):
|
||||
# Copy all incoming blocks into 1 queue which gets processed to db
|
||||
while not dandelion_phase.is_stem_phase() \
|
||||
and dandelion_phase.remaining_time() > 1:
|
||||
|
@ -39,8 +39,8 @@ inbound_dandelion_edge_count = [0]
|
||||
|
||||
|
||||
def gossip_server(
|
||||
peer_set: OrderedSet['Peer'],
|
||||
block_queues: Tuple[Queue['Block'], Queue['Block']],
|
||||
peer_set: "OrderedSet[Peer]",
|
||||
block_queues: Tuple["Queue[Block]", "Queue[Block]"],
|
||||
dandelion_seed: bytes):
|
||||
|
||||
async def peer_connected(
|
||||
|
@ -20,7 +20,7 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
async def accept_stem_blocks(
|
||||
block_queues: Tuple[Queue['Block'], Queue['Block']],
|
||||
block_queues: Tuple["Queue[Block]", "Queue[Block]"],
|
||||
reader: 'StreamReader',
|
||||
writer: 'StreamWriter',
|
||||
inbound_edge_count: List[int]):
|
||||
|
Loading…
Reference in New Issue
Block a user