def dump_tx(tx, netcode, verbose_signature, disassembly_level, do_trace, use_pdb):
    address_prefix = address_prefix_for_netcode(netcode)
    missing_unspents = tx.missing_unspents()
    traceback_f = make_trace_script(do_trace, use_pdb)
    dump_header(tx)
    dump_inputs(tx, netcode, verbose_signature, address_prefix, traceback_f, disassembly_level)

    def signature_for_hash_type_f(hash_type, script):
        return tx.signature_hash(script, idx, hash_type)
    print(('Output%s:' % ('s' if (len(tx.txs_out) != 1) else '')))
    for (idx, tx_out) in enumerate(tx.txs_out):
        amount_mbtc = satoshi_to_mbtc(tx_out.coin_value)
        address = (tx_out.bitcoin_address(netcode=netcode) or '(unknown)')
        print(('%4d: %34s receives %12.5f mBTC' % (idx, address, amount_mbtc)))
        if (disassembly_level > 0):
            for (pre_annotations, pc, opcode, instruction, post_annotations) in disassemble_scripts(b'', tx_out.script, tx.lock_time, signature_for_hash_type_f):
                for l in pre_annotations:
                    print(('           %s' % l))
                if 1:
                    print(('    %4x: %02x  %s' % (pc, opcode, instruction)))
                for l in post_annotations:
                    print(('           %s' % l))
    dump_footer(tx, missing_unspents)
def dump_tx(tx, netcode, verbose_signature, disassembly_level, do_trace, use_pdb):
    address_prefix = address_prefix_for_netcode(netcode)
    missing_unspents = tx.missing_unspents()
    traceback_f = make_trace_script(do_trace, use_pdb)
    dump_header(tx)
    dump_inputs(tx, netcode, verbose_signature, address_prefix, traceback_f, disassembly_level)

    def signature_for_hash_type_f(hash_type, script):
        return tx.signature_hash(script, idx, hash_type)
    print(('Output%s:' % ('s' if (len(tx.txs_out) != 1) else )))
    for (idx, tx_out) in enumerate(tx.txs_out):
        amount_mbtc = satoshi_to_mbtc(tx_out.coin_value)
        address = (tx_out.bitcoin_address(netcode=netcode) or '(unknown)')
        print(('%4d: %34s receives %12.5f mBTC' % (idx, address, amount_mbtc)))
        if (disassembly_level > 0):
            for (pre_annotations, pc, opcode, instruction, post_annotations) in disassemble_scripts(b, tx_out.script, tx.lock_time, signature_for_hash_type_f):
                for l in pre_annotations:
                    print(('           %s' % l))
                if 1:
                    print(('    %4x: %02x  %s' % (pc, opcode, instruction)))
                for l in post_annotations:
                    print(('           %s' % l))
    dump_footer(tx, missing_unspents)