Skip to content

Commit 0a86cef

Browse files
Merge pull request #9 from merklescience/fail_txn
Failed Transactions
2 parents 9ecdd7e + de010db commit 0a86cef

File tree

1 file changed

+3
-36
lines changed

1 file changed

+3
-36
lines changed

zilliqaetl/mappers/transaction_mapper.py

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ def map_transaction(tx_block, txn):
3838
**map_receipt(txn)
3939
}
4040
block["fee"] = block.pop("gas_price") * block.pop("gas_used")
41+
if block["receipt_status"] == 0:
42+
block["value"] = 0
43+
block["hash"]="0x"
4144
return block
4245

4346

@@ -50,39 +53,3 @@ def map_receipt(txn):
5053
'receipt_status': int(receipt.get('success')),
5154
'gas_used': to_int(receipt.get('cumulative_gas'))
5255
}
53-
54-
# The original ones
55-
# def map_transaction(tx_block, txn):
56-
# block = {
57-
# 'type': 'transaction',
58-
# 'id': txn.get('ID'),
59-
# 'block_number': tx_block.get('number'),
60-
# 'block_timestamp': tx_block.get('timestamp'),
61-
# 'amount': to_int(txn.get('amount')),
62-
# 'code': txn.get('code'),
63-
# 'data': txn.get('data'),
64-
# 'gas_limit': to_int(txn.get('gasLimit')),
65-
# 'gas_price': to_int(txn.get('gasPrice')),
66-
# 'nonce': to_int(txn.get('nonce')),
67-
# 'sender_pub_key': txn.get('senderPubKey'),
68-
# 'sender': encode_bench32_pub_key(txn.get('senderPubKey')),
69-
# 'signature': txn.get('signature'),
70-
# 'to_addr': encode_bench32_address(txn.get('toAddr')),
71-
# 'version': to_int(txn.get('version')),
72-
# **map_receipt(txn)
73-
# }
74-
#
75-
# return block
76-
#
77-
#
78-
# def map_receipt(txn):
79-
# receipt = txn.get('receipt')
80-
# if receipt is None:
81-
# return None
82-
#
83-
# return {
84-
# 'accepted': receipt.get('accepted'),
85-
# 'success': receipt.get('success'),
86-
# 'cumulative_gas': to_int(receipt.get('cumulative_gas')),
87-
# 'epoch_num': to_int(receipt.get('epoch_num')),
88-
# }

0 commit comments

Comments
 (0)