Bitcoin Forum
November 09, 2024, 05:08:49 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Custom tx, Inputs and outputs. Help me make this!  (Read 838 times)
lophie (OP)
Hero Member
*****
Offline Offline

Activity: 924
Merit: 1001

Unlimited Free Crypto


View Profile
April 26, 2013, 02:24:08 AM
Last edit: April 26, 2013, 03:01:20 AM by lophie
 #1

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?

Will take me a while to climb up again, But where is a will, there is a way...
ThomasV
Moderator
Legendary
*
Offline Offline

Activity: 1896
Merit: 1353



View Profile WWW
April 26, 2013, 07:15:28 AM
 #2

you're right, this needs to be fixed.

Electrum: the convenience of a web wallet, without the risks
lophie (OP)
Hero Member
*****
Offline Offline

Activity: 924
Merit: 1001

Unlimited Free Crypto


View Profile
April 26, 2013, 09:40:48 AM
 #3

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.

Will take me a while to climb up again, But where is a will, there is a way...
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!