From 75ce55d498315ca567293f53794da1c40d37e88b Mon Sep 17 00:00:00 2001 From: Andrew Whitehead Date: Thu, 9 Apr 2020 10:57:22 -0700 Subject: [PATCH] index revocation state timestamps by the proof identifier timestamp, not the found timestamp Signed-off-by: Andrew Whitehead --- .../protocols/present_proof/v1_0/manager.py | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/aries_cloudagent/protocols/present_proof/v1_0/manager.py b/aries_cloudagent/protocols/present_proof/v1_0/manager.py index c25e35d5ef..7ccae587c0 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/manager.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/manager.py @@ -141,7 +141,7 @@ async def create_bound_request( name=name, version=version, nonce=nonce, - ledger=await self.context.inject(BaseLedger) + ledger=await self.context.inject(BaseLedger), ) presentation_request_message = PresentationRequest( comment=comment, @@ -323,10 +323,7 @@ async def create_presentation( # of the presentation request or attributes current_timestamp = int(time.time()) - non_revoc_interval = { - "from": 0, - "to": current_timestamp - } + non_revoc_interval = {"from": 0, "to": current_timestamp} non_revoc_interval.update( presentation_exchange_record.presentation_request.get("non_revoked", {}) ) @@ -544,20 +541,20 @@ async def verify_presentation( ] = await ledger.get_revoc_reg_def(identifier["rev_reg_id"]) if identifier.get("timestamp"): - ( - found_rev_reg_entry, - found_timestamp, - ) = await ledger.get_revoc_reg_entry( - identifier["rev_reg_id"], identifier["timestamp"] - ) - - if identifier["rev_reg_id"] not in rev_reg_entries: - rev_reg_entries[identifier["rev_reg_id"]] = { - found_timestamp: found_rev_reg_entry - } - else: + rev_reg_entries.setdefault(identifier["rev_reg_id"], {}) + + if ( + identifier["timestamp"] + not in rev_reg_entries[identifier["rev_reg_id"]] + ): + ( + found_rev_reg_entry, + _found_timestamp, + ) = await ledger.get_revoc_reg_entry( + identifier["rev_reg_id"], identifier["timestamp"] + ) rev_reg_entries[identifier["rev_reg_id"]][ - found_timestamp + identifier["timestamp"] ] = found_rev_reg_entry verifier: BaseVerifier = await self.context.inject(BaseVerifier)