Allow the primary contract registry filepath to be mutated within the same blockchain singelton runtime

pull/805/head
Kieran R. Prasch 2019-01-30 18:56:26 -08:00 committed by Kieran Prasch
parent b387edeece
commit 933e5c2270
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
1 changed files with 6 additions and 0 deletions

View File

@ -86,6 +86,12 @@ class Blockchain:
if existing_uri != provider_uri:
raise ValueError("There is an existing blockchain connection to {}. "
"Use Interface.add_provider to connect additional providers".format(existing_uri))
if registry is not None:
# This can happen when there is a cached singleton instance
# but we want to connect using a different registry.
cls._instance.interface.registry = registry
return cls._instance
def get_contract(self, name: str) -> Contract: