tx.add_pubkey_addresses(self.transactions)
# outputs of tx: inputs of tx2
- for x, v in tx.outputs:
- if x.startswith('pubkey:'):
+ for type, x, v in tx.outputs:
+ if type == 'pubkey':
for tx2 in self.transactions.values():
tx2.add_pubkey_addresses({h:tx})
# Insert the change output at a random position in the outputs
posn = random.randint(0, len(outputs))
- outputs[posn:posn] = [( change_addr, change_amount)]
+ outputs[posn:posn] = [( 'address', change_addr, change_amount)]
return outputs
def get_history(self, address):
return default_label
def make_unsigned_transaction(self, outputs, fee=None, change_addr=None, domain=None, coins=None ):
- for address, x in outputs:
- if address.startswith('OP_RETURN:'):
+ for type, address, x in outputs:
+ if type == 'op_return':
continue
- assert is_address(address), "Address " + address + " is invalid!"
- amount = sum( map(lambda x:x[1], outputs) )
+ if type == 'address':
+ assert is_address(address), "Address " + address + " is invalid!"
+ amount = sum( map(lambda x:x[2], outputs) )
inputs, total, fee = self.choose_tx_inputs( amount, fee, len(outputs), domain, coins )
if not inputs:
raise ValueError("Not enough funds")
return False
prev_addresses = prev_addresses[max(0, i - limit):]
for addr in prev_addresses:
- if self.address_is_old(addr):
+ if self.history.get(addr):
return False
return True
def get_master_public_key(self):
"""xpub of the main account"""
- return self.master_public_keys["m/0'"]
+ return self.master_public_keys.get("m/0'")
def get_master_public_keys(self):
out = {}
config = storage.config
self.wallet_types = [
- ('standard', ("Standard wallet"), OldWallet),
- ('imported', ("Imported wallet"), Imported_Wallet),
+ ('standard', ("Standard wallet"), NewWallet if config.get('bip32') else OldWallet),
+ ('imported', ("Imported wallet"), Imported_Wallet),
('2of2', ("Multisig wallet (2 of 2)"), Wallet_2of2),
('2of3', ("Multisig wallet (2 of 3)"), Wallet_2of3)
]