From bd68ebd99ddebd97180810dccb18374905e0ca8f Mon Sep 17 00:00:00 2001 From: Alex Li Date: Thu, 18 Apr 2024 13:14:54 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Avoid=20parent=20container=20`Ke?= =?UTF-8?q?yError`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electrumx/server/block_processor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/electrumx/server/block_processor.py b/electrumx/server/block_processor.py index 6fa82a7d..c81afc4f 100644 --- a/electrumx/server/block_processor.py +++ b/electrumx/server/block_processor.py @@ -2567,7 +2567,11 @@ def populate_dmitem_subtype_specific_fields(self, atomical): f'parent container not found atomical_id={atomical_id}, ' f'parent_container={parent_container}', ) - atomical['$parent_container_name'] = parent_container['$container'] + # The parent container name may not be populated if it's still in the mempool, + # or it's not settled realm request yet. Therefore, check to make sure it exists + # before we can populate this dmitem's container name. + if parent_container.get('$container'): + atomical['$parent_container_name'] = parent_container['$container'] if status == 'verified' and candidate_id == atomical['atomical_id']: atomical['subtype'] = 'dmitem' atomical['$dmitem'] = request_dmitem