electrum

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

commit fe6367cbcd91fc10664417feb88ec0ff8d3f74b2
parent ed22f968f980ddc8d3bfcb203adf32f554493bcd
Author: SomberNight <somber.night@protonmail.com>
Date:   Fri, 30 Nov 2018 18:56:35 +0100

network: validate donation address for server

Diffstat:
Melectrum/network.py | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/electrum/network.py b/electrum/network.py @@ -44,6 +44,7 @@ from .util import PrintError, print_error, log_exceptions, ignore_exceptions, bf from .bitcoin import COIN from . import constants from . import blockchain +from . import bitcoin from .blockchain import Blockchain, HEADER_SIZE from .interface import Interface, serialize_server, deserialize_server, RequestTimedOut from .version import PROTOCOL_VERSION @@ -321,7 +322,11 @@ class Network(PrintError): self.banner = await session.send_request('server.banner') self.notify('banner') async def get_donation_address(): - self.donation_address = await session.send_request('server.donation_address') + addr = await session.send_request('server.donation_address') + if not bitcoin.is_address(addr): + self.print_error(f"invalid donation address from server: {addr}") + addr = '' + self.donation_address = addr async def get_server_peers(): self.server_peers = parse_servers(await session.send_request('server.peers.subscribe')) self.notify('servers')