Fix condition omission checking ipc in middleware
This commit is contained in:
parent
2c34777ff1
commit
6a72b594f9
@ -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
|
||||
|
@ -29,6 +29,7 @@ class PlatformMiddleware:
|
||||
def __init__(self, make_request, w3):
|
||||
self.w3 = w3
|
||||
self.make_request = make_request
|
||||
if ipcaddr == None:
|
||||
raise AttributeError('ipcaddr not set')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user