Skip to content

Commit

Permalink
Be a bit more forgiving on errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Corallo committed Jan 20, 2012
1 parent c477afd commit fa7d478
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions wallet.py
Expand Up @@ -37,11 +37,16 @@ def parse_wallet(db, item_callback):
kds.clear(); kds.write(key)
vds.clear(); vds.write(value)

type = kds.read_string()
try:
type = kds.read_string()

d["__key__"] = key
d["__value__"] = value
d["__type__"] = type
d["__key__"] = key
d["__value__"] = value
d["__type__"] = type

except Exception, e:
print("ERROR attempting to read data from wallet.dat, type %s"%type)
continue

try:
if type == "tx":
Expand Down Expand Up @@ -100,7 +105,8 @@ def parse_wallet(db, item_callback):
d['scriptHash'] = kds.read_bytes(20)
d['script'] = vds.read_bytes(vds.read_compact_size())
else:
print "Unknown key type: "+type
print "Skipping item of type "+type
continue

item_callback(type, d)

Expand Down

0 comments on commit fa7d478

Please sign in to comment.