def dump_header(tx):
    tx_bin = stream_to_bytes(tx.stream)
    print(('Version: %2d  tx hash %s  %d bytes' % (tx.version, tx.id(), len(tx_bin))))
    if tx.has_witness_data():
        print(('      segwit tx hash %s' % tx.w_id()))
    print(('TxIn count: %d; TxOut count: %d' % (len(tx.txs_in), len(tx.txs_out))))
    if (tx.lock_time == 0):
        meaning = 'valid anytime'
    elif (tx.lock_time < LOCKTIME_THRESHOLD):
        meaning = ('valid after block index %d' % tx.lock_time)
    else:
        when = datetime.datetime.utcfromtimestamp(tx.lock_time)
        meaning = ('valid on or after %s utc' % when.isoformat())
    print(('Lock time: %d (%s)' % (tx.lock_time, meaning)))
    print(('Input%s:' % ('s' if (len(tx.txs_in) != 1) else '')))
def dump_header(tx):
    tx_bin = stream_to_bytes(tx.stream)
    print(('Version: %2d  tx hash %s  %d bytes' % (tx.version, tx.id(), len(tx_bin))))
    if tx.has_witness_data():
        print(('      segwit tx hash %s' % tx.w_id()))
    print(('TxIn count: %d; TxOut count: %d' % (len(tx.txs_in), len(tx.txs_out))))
    if (tx.lock_time == 0):
        meaning = 'valid anytime'
    elif (tx.lock_time < LOCKTIME_THRESHOLD):
        meaning = ('valid after block index %d' % tx.lock_time)
    else:
        when = datetime.datetime.utcfromtimestamp(tx.lock_time)
        meaning = ('valid on or after %s utc' % when.isoformat())
    print(('Lock time: %d (%s)' % (tx.lock_time, meaning)))
    print(('Input%s:' % ('s' if (len(tx.txs_in) != 1) else )))