def _audit_txn_by_pp_seq_no(audit_ledger: Ledger, pp_seq_no: int) -> (dict, int): # TODO: Should we put it into some common code? seq_no = audit_ledger.size txn = None while seq_no > 0: txn = audit_ledger.getBySeqNo(seq_no) txn_data = get_payload_data(txn) audit_pp_seq_no = txn_data[AUDIT_TXN_PP_SEQ_NO] if audit_pp_seq_no == pp_seq_no: break seq_no -= 1 return txn, seq_no
def _audit_seq_no_from_3pc_key(audit_ledger: Ledger, view_no: int, pp_seq_no: int) -> int: # TODO: Should we put it into some common code? seq_no = audit_ledger.size while seq_no > 0: txn = audit_ledger.getBySeqNo(seq_no) txn_data = get_payload_data(txn) audit_view_no = txn_data[AUDIT_TXN_VIEW_NO] audit_pp_seq_no = txn_data[AUDIT_TXN_PP_SEQ_NO] if audit_view_no == view_no and audit_pp_seq_no == pp_seq_no: break seq_no -= 1 return seq_no