123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- """
- tx-btc2bch: Convert MMGen transaction files from BTC to BCH format
- """
- from mmgen.common import *
- opts_data = {
- 'text': {
- 'desc': """Convert {pnm} transaction files from BTC to BCH format""".format(pnm=g.proj_name),
- 'usage':'[opts] [mmgen transaction file]',
- 'options': """
- -h, --help Print this help message
- --, --longhelp Print help message for long options (common options)
- -v, --verbose Produce more verbose output
- """
- }
- }
- cmd_args = opts.init(opts_data)
- if g.coin != 'BTC':
- die(1,"This program must be run with --coin set to 'BTC'")
- if len(cmd_args) != 1: opts.usage()
- import mmgen.tx
- tx = mmgen.tx.MMGenTX(cmd_args[0])
- if opt.verbose:
- gmsg('Original transaction is in {} format'.format(g.coin))
- from mmgen.protocol import init_coin
- init_coin('BCH')
- if opt.verbose:
- gmsg('Converting transaction to {} format'.format(g.coin))
- tx.inputs.convert_coin(verbose=opt.verbose)
- tx.outputs.convert_coin(verbose=opt.verbose)
- tx.desc = 'converted transaction'
- tx.write_to_file(ask_write=False,ask_overwrite=False)
|