electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 56a9ccca6df0c992b845ea363a6696c2efbcabb7
parent 38980a4f5cdccd3816bc0130c8471104fa805aab
Author: SomberNight <somber.night@protonmail.com>
Date:   Sat, 25 Apr 2020 06:38:26 +0200

interface: make localhost exempt from ip-range bucketing

Diffstat:
Melectrum/interface.py | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/electrum/interface.py b/electrum/interface.py @@ -31,7 +31,7 @@ import asyncio import socket from typing import Tuple, Union, List, TYPE_CHECKING, Optional, Set, NamedTuple from collections import defaultdict -from ipaddress import IPv4Network, IPv6Network, ip_address, IPv6Address +from ipaddress import IPv4Network, IPv6Network, ip_address, IPv6Address, IPv4Address import itertools import logging import hashlib @@ -794,11 +794,13 @@ class Interface(Logger): if self.is_tor(): return BUCKET_NAME_OF_ONION_SERVERS try: - ip_addr = ip_address(self.ip_addr()) + ip_addr = ip_address(self.ip_addr()) # type: Union[IPv4Address, IPv6Address] except ValueError: return '' if not ip_addr: return '' + if ip_addr.is_loopback: # localhost is exempt + return '' if ip_addr.version == 4: slash16 = IPv4Network(ip_addr).supernet(prefixlen_diff=32-16) return str(slash16)