commit 6a72b594f9bdf8eed004105fc17c98679a3cc37d
parent 2c34777ff13a24859a4d291cc75d9cf480384bea
Author: nolash <dev@holbrook.no>
Date: Sat, 17 Oct 2020 15:03:56 +0200
Fix condition omission checking ipc in middleware
Diffstat:
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
@@ -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
@@ -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