Fix condition omission checking ipc in middleware

This commit is contained in:
nolash 2020-10-17 15:03:56 +02:00
parent 2c34777ff1
commit 6a72b594f9
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 6 additions and 1 deletions

View File

@ -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

View File

@ -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