@@ -277,17 +277,22 @@ def _map_status_error(self, response: response_pb2.Response) -> PrecheckError |
277277 TransactionReceipt ._from_proto (response .transactionGetReceipt .receipt , self .transaction_id ),
278278 )
279279
280- def _map_receipt_list (self , receipts : list [transaction_receipt_pb2 .TransactionReceipt ]) -> list [TransactionReceipt ]:
280+ def _map_receipt_list (
281+ self , receipts : list [transaction_receipt_pb2 .TransactionReceipt ], include_parent_tx_id : bool = False
282+ ) -> list [TransactionReceipt ]:
281283 """
282284 Maps a list of protobuf transaction receipts to TransactionReceipt objects.
283285
284286 Args:
285287 receipts: A list of protobuf TransactionReceipt objects
288+ include_parent_tx_id: If True, pass parent transaction_id to mapped receipts (for duplicates).
289+ If False, pass None (for child receipts).
286290
287291 Returns:
288292 A list of TransactionReceipt objects
289293 """
290- return [TransactionReceipt ._from_proto (receipt_proto , self .transaction_id ) for receipt_proto in receipts ]
294+ transaction_id = self .transaction_id if include_parent_tx_id else None
295+ return [TransactionReceipt ._from_proto (receipt_proto , transaction_id ) for receipt_proto in receipts ]
291296
292297 def execute (self , client : Client , timeout : int | float | None = None ) -> TransactionReceipt :
293298 """
@@ -315,12 +320,18 @@ def execute(self, client: Client, timeout: int | float | None = None) -> Transac
315320 parent = TransactionReceipt ._from_proto (response .transactionGetReceipt .receipt , self .transaction_id )
316321
317322 if self .include_children :
318- children = self ._map_receipt_list (response .transactionGetReceipt .child_transaction_receipts )
323+ # Child receipts are sub-transactions; they don't need parent transaction_id
324+ children = self ._map_receipt_list (
325+ response .transactionGetReceipt .child_transaction_receipts , include_parent_tx_id = False
326+ )
319327
320328 parent ._set_children (children )
321329
322330 if self .include_duplicates :
323- duplicates = self ._map_receipt_list (response .transactionGetReceipt .duplicateTransactionReceipts )
331+ # Duplicate receipts are related to parent; keep parent transaction_id for context
332+ duplicates = self ._map_receipt_list (
333+ response .transactionGetReceipt .duplicateTransactionReceipts , include_parent_tx_id = True
334+ )
324335
325336 parent ._set_duplicates (duplicates )
326337
0 commit comments