Skip to content

Commit

Permalink
Fix undefineds identified by flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
sphericale committed Feb 25, 2020
1 parent 91cce3b commit 1f5bef9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion electrum/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def get_target(self, height, chain=None):
def chainwork_of_header_at_height(self, height: int) -> int:
"""work done by single header at given height"""
chunk_idx = height // 2016 - 1
target = self.get_target(index * 2016)
target = self.get_target(chunk_idx)
work = ((2 ** 256 - target - 1) // (target + 1)) + 1
return work

Expand Down
7 changes: 6 additions & 1 deletion electrum/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
import time
import threading
import sys
from typing import NamedTuple, Any, Union, TYPE_CHECKING, Optional
from typing import (NamedTuple, Any, Union, TYPE_CHECKING, Optional, Tuple,
Dict, Iterable, List)

from .i18n import _
from .util import (profiler, DaemonThread, UserCancelled, ThreadJob)
Expand All @@ -37,6 +38,10 @@
from .simple_config import SimpleConfig
from .logging import get_logger, Logger

if TYPE_CHECKING:
from .plugins.hw_wallet import HW_PluginBase, HardwareClientBase
from .keystore import Hardware_KeyStore


_logger = get_logger(__name__)
plugin_loaders = {}
Expand Down
3 changes: 2 additions & 1 deletion electrum/plugins/ledger/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import traceback

from electrum import ecc
from electrum import constants
from electrum.bitcoin import TYPE_ADDRESS, int_to_hex, var_int, is_segwit_script_type
from electrum.bip32 import BIP32Node
from electrum.i18n import _
Expand Down Expand Up @@ -185,7 +186,7 @@ def perform_hw1_preflight(self):
raise UserFacingException('Aborted by user - please unplug the dongle and plug it again before retrying')
pin = pin.encode()
self.dongleObject.verifyPin(pin)
self.dongleObject.setAlternateCoinVersions(ADDRTYPE_P2PKH, ADDRTYPE_P2SH)
self.dongleObject.setAlternateCoinVersions(constants.net.ADDRTYPE_P2PKH, constants.net.ADDRTYPE_P2SH)
except BTChipException as e:
if (e.sw == 0x6faa):
raise UserFacingException("Dongle is temporarily locked - please unplug it and replug it again")
Expand Down

0 comments on commit 1f5bef9

Please sign in to comment.