Skip to content

Commit

Permalink
patch inconsistencies in in- and out-relations
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommel71 committed Mar 6, 2024
1 parent b155f3f commit 4deed3e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
33 changes: 24 additions & 9 deletions src/graphsenselib/deltaupdate/update/account/createchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,6 @@ def prepare_relations_for_ingest(
inr = inrelations[
(relations_update.src_identifier, relations_update.dst_identifier)
].result_or_exc.one()
if (outr is None) == (inr is None):
pass
else:
debug_msg = "inoutcheck: inconsistency "
debug_msg += f"src: {bytes.hex(relations_update.src_identifier)} "
debug_msg += f"dst: {bytes.hex(relations_update.dst_identifier)} "
debug_msg += f"inr: {inr} "
debug_msg += f"outr: {outr} "
logger.warning(debug_msg)

# assert (outr is None) == (inr is None)

Expand All @@ -154,6 +145,30 @@ def prepare_relations_for_ingest(
id_dst, id_src, id_bucket_size, relations_nbuckets
)

# checking and logging inconsistencies
if (outr is None) == (inr is None):
pass
else:
debug_msg = "inoutcheck: inconsistency "
debug_msg += f"src: {bytes.hex(relations_update.src_identifier)} "
debug_msg += f"dst: {bytes.hex(relations_update.dst_identifier)} "
debug_msg += f"inr: {inr} "
debug_msg += f"outr: {outr} "
logger.warning(debug_msg)

# missing record patching
if (outr is None) and (inr is not None):
outr = MutableNamedTuple(**inr._asdict())

outr.src_address_id_group = src_group
outr.src_address_id_secondary_group = src_secondary

if (inr is None) and (outr is not None):
inr = MutableNamedTuple(**outr._asdict())

inr.dst_address_id_group = dst_group
inr.dst_address_id_secondary_group = dst_secondary

if outr is None:
"""new address relation to insert"""
new_relations_out[relations_update.src_identifier] += 1
Expand Down
1 change: 0 additions & 1 deletion src/graphsenselib/deltaupdate/update/account/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ def get_fee_data(self, cache, txs):
return cache.get(("fee", txs), [{"fee": None}])[0]["fee"]

def process_batch_impl_hook(self, batch: List[int]) -> Tuple[Action, Optional[int]]:
logger.warning(f"inoutcheck: batch {batch}")
rates = {}
transactions = []
traces = []
Expand Down

0 comments on commit 4deed3e

Please sign in to comment.