Author

Topic: Custom tx, Inputs and outputs. Help me make this! (Read 843 times)

hero member
Activity: 924
Merit: 1001
Unlimited Free Crypto
Leave it to me, on the journey to learn. Just check on me from time to time and cheach me. Thank.you very much for you awesome work.
legendary
Activity: 1896
Merit: 1353
you're right, this needs to be fixed.
hero member
Activity: 924
Merit: 1001
Unlimited Free Crypto
Hi guys. I am working on a plugin for Electrum (v1.7.3). I just noticed that currently making a tx with multiple inputs and outputs is broken so I am trying to add this to Electrum.

I am very new to python so don't be harsh. I am learning here and asking for help  Grin

I am having a small problem understanding the code and I would love some help. thank you in advance.

In /lib/commands.py for the function _mktx. The last variable it passes to wallet.mktx is domain which is an array of addresses which are tested with is_valid(add) just like the outputs, so it is safe to assume they are bitcoin addresses. However in the implementation of wallet.mktx in /lib/wallet.py I saw this:

Code:
def mktx(self, outputs, password, fee=None, change_addr=None, account=None ):
        """
        create a transaction
        account parameter:
           None means use all accounts
           -1 means imported keys
           0, 1, etc are seed accounts
        """

So I noticed that the comment suggests account to be an integer value  Huh! Following the variable led me to get_account_addresses in /lib/wallet.py where it is really treated as an Integer!:

Code:
def get_account_addresses(self, a, include_change=True):
        if a is None:
            o = self.addresses(True)
        elif a == -1:
            o = self.imported_keys.keys()
        else:
            ac = self.accounts[a]
            o = ac[0][:]
            if include_change: o += ac[1]
        return o

So I guess what I am asking of you is to tell me and help me understand is that supposed to work and how would it!  Huh, or simply half baked code which have to be fixed?
Jump to: