1
0

fix is_address (forgot p2sh)

This commit is contained in:
ThomasV
2015-07-02 08:53:17 +02:00
parent c0858f314f
commit 0c37009cdb
3 changed files with 47 additions and 21 deletions

View File

@@ -358,7 +358,7 @@ def is_address(addr):
addrtype, h = bc_address_to_hash_160(addr)
except Exception:
return False
if addrtype != 0:
if addrtype not in [0, 5]:
return False
return addr == hash_160_to_bc_address(h, addrtype)

View File

@@ -196,7 +196,7 @@ class Abstract_Wallet(object):
for tx_hash, raw in tx_list.items():
tx = Transaction(raw)
self.transactions[tx_hash] = tx
if self.txi.get(tx_hash) is None and self.txo.get(tx_hash) is None:
if self.txi.get(tx_hash) is None and self.txo.get(tx_hash) is None and (tx_hash not in self.pruned_txo.values()):
print_error("removing unreferenced tx", tx_hash)
self.transactions.pop(tx_hash)
@@ -748,6 +748,14 @@ class Abstract_Wallet(object):
if (tx_hash, height) not in hist:
self.remove_transaction(tx_hash, height)
# fix: maybe remove only at the end, tx that have only unspent outputs
# bug: if tx is used by many addresses, not clear what we should do..
# we should remove tx iff it is completely unreferenced
# note about balance bug: on fist sync, it downloaded a lot of new tx, and I had a wrong balance.
# after one reconnection it was fixed. (probably after changing server, going from pruned to long)
# this could be related to the 'download missing tx' behaviour, that kicks in on startup
self.history[addr] = hist
self.storage.put('addr_history', self.history, True)