@@ -183,12 +183,12 @@ async def fix_and_publish_from_invalid_accum_err(profile: Profile, err_msg: str)
183183 async def check_retry (accum ):
184184 """Used to manage retries for fixing revocation registry entries."""
185185 if cache is None :
186- if cache is None :
187- LOGGER . warning (
188- "No cache backend configured; skipping retry tracking for %s" ,
189- accum ,
190- )
191- return
186+ LOGGER . warning (
187+ "No cache backend configured; skipping retry tracking for %s" ,
188+ accum ,
189+ )
190+ return
191+
192192 retry_value = await cache .get (accum )
193193 if not retry_value :
194194 await cache .set (accum , 5 )
@@ -276,7 +276,6 @@ async def create_and_send_endorser_txn():
276276
277277 # If the accum from the ledger matches the error message, fix it
278278 if accum and accum in err_msg :
279- # If the accum from the ledger matches the error message, fix it
280279 # if accum and accum in err_msg:
281280 await check_retry (accum )
282281
@@ -391,19 +390,24 @@ async def fix_ledger_entry(
391390 endorser_did = endorser_did ,
392391 )
393392
394- applied_txn = ledger_response ["result" ]
395-
396- # Update the local wallets rev reg entry with the new accumulator value
397- rev_list_value_json = rev_list .value_json
398- rev_list_value_json ["rev_list" ]["currentAccumulator" ] = applied_txn ["txn" ][
399- "data"
400- ]["value" ]["accum" ]
401- rev_list .current_accumulator = applied_txn ["txn" ]["data" ]["value" ]["accum" ]
402- await session .handle .replace (
403- CATEGORY_REV_LIST ,
404- rev_list .rev_reg_def_id ,
405- rev_list_value_json ,
406- rev_list .tags ,
407- )
408-
409- return (rev_reg_delta , recovery_txn , applied_txn )
393+ if isinstance (ledger_response , dict ) and "result" in ledger_response :
394+ applied_txn = ledger_response ["result" ]
395+
396+ # Update the local wallets rev reg entry with the new accumulator value
397+ rev_list_value_json = rev_list .value_json
398+ rev_list_value_json ["rev_list" ]["currentAccumulator" ] = applied_txn [
399+ "txn"
400+ ]["data" ]["value" ]["accum" ]
401+ rev_list .current_accumulator = applied_txn ["txn" ]["data" ]["value" ][
402+ "accum"
403+ ]
404+ await session .handle .replace (
405+ CATEGORY_REV_LIST ,
406+ rev_list .rev_reg_def_id ,
407+ rev_list_value_json ,
408+ rev_list .tags ,
409+ )
410+ return (rev_reg_delta , recovery_txn , applied_txn )
411+
412+ # Ledger update not applied, return without applied_txn
413+ return (rev_reg_delta , recovery_txn , {})
0 commit comments