Skip to content

Commit

Permalink
Merge pull request #3223 from pirapira/dead-code
Browse files Browse the repository at this point in the history
Remove some dead code as reported from vulture
  • Loading branch information
LefterisJP committed Jan 4, 2019
2 parents 5368777 + ff809d7 commit 8f17677
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 57 deletions.
21 changes: 0 additions & 21 deletions raiden/blockchain/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,27 +145,6 @@ def get_all_netting_channel_events(
)


def get_all_secret_registry_events(
chain: BlockChainService,
secret_registry_address: Address,
contract_manager: ContractManager,
from_block: BlockSpecification = GENESIS_BLOCK_NUMBER,
to_block: BlockSpecification = 'latest',
) -> List[Dict]:
""" Helper to get all events of a SecretRegistry. """

return get_contract_events(
chain,
contract_manager.get_contract_abi(
CONTRACT_SECRET_REGISTRY,
),
secret_registry_address,
ALL_EVENTS,
from_block,
to_block,
)


def decode_event_to_internal(event):
""" Enforce the binary encoding of address for internal usage. """
data = event.event_data
Expand Down
7 changes: 0 additions & 7 deletions raiden/connection_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import gevent
import structlog
from eth_utils import decode_hex
from gevent.event import AsyncResult
from gevent.lock import Semaphore

from raiden import waiting
Expand Down Expand Up @@ -166,12 +165,6 @@ def connect(
else:
self._open_channels()

def leave_async(self):
""" Async version of `leave()` """
leave_result = AsyncResult()
gevent.spawn(self.leave).link(leave_result)
return leave_result

def leave(self, registry_address):
""" Leave the token network.
Expand Down
10 changes: 0 additions & 10 deletions raiden/network/transport/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,16 +1000,6 @@ def _send_with_retry(
retrier = self._get_retrier(queue_identifier.recipient)
retrier.enqueue(queue_identifier=queue_identifier, message=message)

def _send_immediate(
self,
queue_identifier: QueueIdentifier,
message: Message,
):
data = JSONSerializer.serialize(message)
receiver_address = queue_identifier.recipient

self._send_raw(receiver_address, data)

def _send_raw(self, receiver_address: Address, data: str):
with self._getroom_lock:
room = self._get_room_for_address(receiver_address)
Expand Down
20 changes: 1 addition & 19 deletions raiden/raiden_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from gevent.event import AsyncResult, Event
from gevent.lock import Semaphore

from raiden import constants, routing, waiting
from raiden import constants, routing
from raiden.blockchain.events import BlockchainEvents
from raiden.blockchain_events_handler import on_blockchain_event
from raiden.connection_manager import ConnectionManager
Expand Down Expand Up @@ -51,7 +51,6 @@
from raiden.transfer.state_change import (
ActionChangeNodeNetworkState,
ActionInitChain,
ActionLeaveAllNetworks,
Block,
ContractReceiveNewPaymentNetwork,
)
Expand Down Expand Up @@ -738,23 +737,6 @@ def connection_manager_for_token_network(

return manager

def leave_all_token_networks(self):
state_change = ActionLeaveAllNetworks()
self.handle_state_change(state_change)

def close_and_settle(self):
log.info('raiden will close and settle all channels now')

self.leave_all_token_networks()

connection_managers = [cm for cm in self.tokennetworkids_to_connectionmanagers.values()]

if connection_managers:
waiting.wait_for_settle_all_channels(
self,
self.alarm.sleep_time,
)

def mediated_transfer_async(
self,
token_network_identifier: TokenNetworkID,
Expand Down

0 comments on commit 8f17677

Please sign in to comment.