__init__.py (680B)
1 # standard imports 2 import datetime 3 import logging 4 5 logg = logging.getLogger(__name__) 6 7 8 def apply(c, result, chain_spec, conn, block, tx, db_session=None): 9 timestamp = datetime.datetime.fromtimestamp(block.timestamp) 10 value = str(tx.value) 11 if len(value) < 19: 12 value = '{:018d}'.format(tx.value) 13 value = '0.' + value 14 else: 15 ridx = len(value) - 18 16 value = '{}.{}'.format(value[:ridx], value[ridx:]) 17 value = value.rstrip('0') 18 if value[len(value)-1] == '.': 19 value += '0' 20 21 s = '{} {} {}\t{} -> {} = {}'.format(timestamp, tx.hash, tx.status.name, tx.outputs[0], tx.inputs[0], value) 22 result.set(s) 23 return False