From 6a72b594f9bdf8eed004105fc17c98679a3cc37d Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 17 Oct 2020 15:03:56 +0200 Subject: [PATCH] Fix condition omission checking ipc in middleware --- crypto_dev_signer/eth/web3ext/__init__.py | 4 ++++ crypto_dev_signer/eth/web3ext/middleware.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto_dev_signer/eth/web3ext/__init__.py b/crypto_dev_signer/eth/web3ext/__init__.py index 83b0ec7..7dda657 100644 --- a/crypto_dev_signer/eth/web3ext/__init__.py +++ b/crypto_dev_signer/eth/web3ext/__init__.py @@ -1,3 +1,4 @@ +import logging import re from web3 import Web3 as Web3super @@ -7,6 +8,8 @@ from .middleware import PlatformMiddleware re_websocket = re.compile('^wss?://') re_http = re.compile('^https?://') +logg = logging.getLogger(__file__) + def create_middleware(ipcpath): PlatformMiddleware.ipcaddr = ipcpath @@ -24,6 +27,7 @@ def Web3(blockchain_provider='ws://localhost:8546', ipcpath=None): w3 = Web3super(provider) if ipcpath != None: + logg.info('using signer middleware with ipc {}'.format(ipcpath)) w3.middleware_onion.add(create_middleware(ipcpath)) w3.eth.personal = w3.geth.personal diff --git a/crypto_dev_signer/eth/web3ext/middleware.py b/crypto_dev_signer/eth/web3ext/middleware.py index d5657c1..c3c64fa 100644 --- a/crypto_dev_signer/eth/web3ext/middleware.py +++ b/crypto_dev_signer/eth/web3ext/middleware.py @@ -29,7 +29,8 @@ class PlatformMiddleware: def __init__(self, make_request, w3): self.w3 = w3 self.make_request = make_request - raise AttributeError('ipcaddr not set') + if ipcaddr == None: + raise AttributeError('ipcaddr not set') # TODO: understand what format input params come in