set the active provider on RPC condition when configured

pull/3185/head
Kieran Prasch 2023-08-20 15:38:36 +02:00
parent 280fe0d0f9
commit 41b28ab05d
1 changed files with 2 additions and 0 deletions

View File

@ -152,6 +152,7 @@ class RPCCondition(AccessControlCondition):
# internal # internal
self.name = name self.name = name
self.chain = chain self.chain = chain
self.provider: Optional[BaseProvider] = None # set in _configure_provider
self.method = self.validate_method(method=method) self.method = self.validate_method(method=method)
# test # test
@ -188,6 +189,7 @@ class RPCCondition(AccessControlCondition):
def _configure_w3(self, provider: BaseProvider) -> Web3: def _configure_w3(self, provider: BaseProvider) -> Web3:
# Instantiate a local web3 instance # Instantiate a local web3 instance
self.provider = provider
w3 = Web3(provider) w3 = Web3(provider)
if self.chain in POA_CHAINS: if self.chain in POA_CHAINS:
# inject web3 middleware to handle POA chain extra_data field. # inject web3 middleware to handle POA chain extra_data field.