Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix order of operations connecting faber to endorser #1716

Merged
merged 4 commits into from
Apr 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions demo/runners/support/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,12 @@ async def register_or_switch_wallet(
new_wallet = await self.agency_admin_POST("/multitenancy/wallet", wallet_params)
self.log("New wallet params:", new_wallet)
self.managed_wallet_params = new_wallet

# if endorser, endorse the wallet ledger operations
if endorser_agent:
if not await connect_wallet_to_endorser(self, endorser_agent):
raise Exception("Endorser setup FAILED :-(")

if public_did:
if cred_type == CRED_FORMAT_INDY:
# assign public did
Expand All @@ -581,7 +587,11 @@ async def register_or_switch_wallet(
did=new_did["result"]["did"],
verkey=new_did["result"]["verkey"],
)
await self.admin_POST("/wallet/did/public?did=" + self.did)
if self.endorser_role and self.endorser_role == "author":
if endorser_agent:
await self.admin_POST("/wallet/did/public?did=" + self.did)
else:
await self.admin_POST("/wallet/did/public?did=" + self.did)
elif cred_type == CRED_FORMAT_JSON_LD:
# create did of appropriate type
data = {"method": DID_METHOD_KEY, "options": {"key_type": KEY_TYPE_BLS}}
Expand All @@ -599,11 +609,6 @@ async def register_or_switch_wallet(
log_msg("Mediation setup FAILED :-(")
raise Exception("Mediation setup FAILED :-(")

# if endorser, endorse the wallet ledger operations
if endorser_agent:
if not await connect_wallet_to_endorser(self, endorser_agent):
raise Exception("Endorser setup FAILED :-(")

self.log(f"Created NEW wallet {target_wallet_name}")
return True

Expand Down