py3 in qtgui
This commit is contained in:
@@ -51,7 +51,7 @@ from .version import *
|
||||
from .keystore import load_keystore, Hardware_KeyStore
|
||||
from .storage import multisig_type
|
||||
|
||||
import transaction
|
||||
from . import transaction
|
||||
from .transaction import Transaction
|
||||
from .plugins import run_hook
|
||||
from . import bitcoin
|
||||
@@ -297,6 +297,7 @@ class Abstract_Wallet(PrintError):
|
||||
self.verifier.merkle_roots.pop(tx_hash, None)
|
||||
|
||||
# tx will be verified only if height > 0
|
||||
print('unverif', tx_hash, tx_height)
|
||||
if tx_hash not in self.verified_tx:
|
||||
self.unverified_tx[tx_hash] = tx_height
|
||||
|
||||
@@ -759,7 +760,7 @@ class Abstract_Wallet(PrintError):
|
||||
return ''
|
||||
|
||||
def get_tx_status(self, tx_hash, height, conf, timestamp):
|
||||
from util import format_time
|
||||
from .util import format_time
|
||||
if conf == 0:
|
||||
tx = self.transactions.get(tx_hash)
|
||||
if not tx:
|
||||
@@ -1417,16 +1418,11 @@ class Imported_Wallet(Abstract_Wallet):
|
||||
|
||||
def add_input_sig_info(self, txin, address):
|
||||
addrtype, hash160 = bc_address_to_hash_160(address)
|
||||
if six.PY3:
|
||||
x_pubkey = 'fd' + bh2u(bytes([addrtype]) + hash160)
|
||||
else:
|
||||
x_pubkey = 'fd' + bh2u(chr(addrtype) + hash160)
|
||||
x_pubkey = 'fd' + bh2u(bytes([addrtype]) + hash160)
|
||||
txin['x_pubkeys'] = [x_pubkey]
|
||||
txin['signatures'] = [None]
|
||||
|
||||
|
||||
|
||||
|
||||
class Deterministic_Wallet(Abstract_Wallet):
|
||||
|
||||
def __init__(self, storage):
|
||||
@@ -1508,7 +1504,7 @@ class Deterministic_Wallet(Abstract_Wallet):
|
||||
if len(addresses) < limit:
|
||||
self.create_new_address(for_change)
|
||||
continue
|
||||
if map(lambda a: self.address_is_old(a), addresses[-limit:] ) == limit*[False]:
|
||||
if list(map(lambda a: self.address_is_old(a), addresses[-limit:] )) == limit*[False]:
|
||||
break
|
||||
else:
|
||||
self.create_new_address(for_change)
|
||||
@@ -1521,7 +1517,7 @@ class Deterministic_Wallet(Abstract_Wallet):
|
||||
else:
|
||||
if len(self.receiving_addresses) != len(self.keystore.keypairs):
|
||||
pubkeys = self.keystore.keypairs.keys()
|
||||
self.receiving_addresses = map(self.pubkeys_to_address, pubkeys)
|
||||
self.receiving_addresses = [self.pubkeys_to_address(i) for i in pubkeys]
|
||||
self.save_addresses()
|
||||
for addr in self.receiving_addresses:
|
||||
self.add_address(addr)
|
||||
@@ -1652,7 +1648,7 @@ class P2SH:
|
||||
|
||||
def pubkeys_to_address(self, pubkey):
|
||||
redeem_script = self.pubkeys_to_redeem_script(pubkey)
|
||||
return bitcoin.hash160_to_p2sh(hash_160(redeem_script.decode('hex')))
|
||||
return bitcoin.hash160_to_p2sh(hash_160(bfh(redeem_script)))
|
||||
|
||||
|
||||
class Standard_Wallet(Simple_Deterministic_Wallet):
|
||||
@@ -1664,17 +1660,14 @@ class Standard_Wallet(Simple_Deterministic_Wallet):
|
||||
|
||||
def pubkeys_to_address(self, pubkey):
|
||||
if not self.is_segwit:
|
||||
return bitcoin.public_key_to_p2pkh(pubkey.decode('hex'))
|
||||
return bitcoin.public_key_to_p2pkh(bfh(pubkey))
|
||||
elif bitcoin.TESTNET:
|
||||
redeem_script = self.pubkeys_to_redeem_script(pubkey)
|
||||
return bitcoin.hash160_to_p2sh(hash_160(redeem_script.decode('hex')))
|
||||
return bitcoin.hash160_to_p2sh(hash_160(bfh(redeem_script)))
|
||||
else:
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class Multisig_Wallet(Deterministic_Wallet, P2SH):
|
||||
# generic m of n
|
||||
gap_limit = 20
|
||||
|
||||
Reference in New Issue
Block a user