URI: 
       tfix #2231: same serialize/deserialize format - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 1aeeab9ec6e90f33194d657a9034796aba9872bb
   DIR parent 9cb576a88c962b7bf6e0b81279906d7e597be580
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Sat,  4 Mar 2017 11:14:44 +0100
       
       fix #2231: same serialize/deserialize format
       
       Diffstat:
         M lib/commands.py                     |      17 +++++++----------
       
       1 file changed, 7 insertions(+), 10 deletions(-)
       ---
   DIR diff --git a/lib/commands.py b/lib/commands.py
       t@@ -195,7 +195,9 @@ class Commands:
        
            @command('')
            def serialize(self, jsontx):
       -        """Create a transaction from json inputs. Inputs must have a redeemPubkey. Outputs must be a list of (address, value).
       +        """Create a transaction from json inputs.
       +        Inputs must have a redeemPubkey.
       +        Outputs must be a list of {'address':address, 'value':satoshi_amount}.
                """
                keypairs = {}
                inputs = jsontx.get('inputs')
       t@@ -206,23 +208,18 @@ class Commands:
                        prevout_hash, prevout_n = txin['output'].split(':')
                        txin['prevout_n'] = int(prevout_n)
                        txin['prevout_hash'] = prevout_hash
       -            else:
       -                raise BaseException('Output point missing', txin)
                    if txin.get('redeemPubkey'):
                        pubkey = txin['redeemPubkey']
       -                txin['pubkeys'] = [pubkey]
       +                txin['type'] = 'p2pkh'
                        txin['x_pubkeys'] = [pubkey]
                        txin['signatures'] = [None]
                        txin['num_sig'] = 1
       -                privkey = txin.get('privkey')
       -                if privkey:
       -                    keypairs[pubkey] = privkey
       +                if txin.get('privkey'):
       +                    keypairs[pubkey] = txin['privkey']
                    elif txin.get('redeemScript'):
                        raise BaseException('Not implemented')
       -            else:
       -                raise BaseException('No redeem script')
        
       -        outputs = map(lambda x: (TYPE_ADDRESS, x[0], satoshis(x[1])), outputs)
       +        outputs = map(lambda x: (TYPE_ADDRESS, x['address'], int(x['value'])), outputs)
                tx = Transaction.from_io(inputs, outputs, locktime=locktime)
                tx.sign(keypairs)
                return tx.as_dict()