Add slush's fix to avoid crashing on corrupted sectors and --dont_check_walletversion option

This commit is contained in:
jackjack 2011-12-19 14:25:42 +01:00
parent 62eacee039
commit 551ea9ac3c

View File

@ -548,7 +548,14 @@ def first_read(device, size, prekeys, inc=10000):
d = datetime.fromtimestamp(ETAts)
print(d.strftime(" ETA: %H:%M:%S"))
data = os.read (fd, inc)
try:
data = os.read (fd, inc)
except Exception as exc:
os.lseek(fd, inc, os.SEEK_CUR)
print str(exc)
i += inc
continue
contains_key = one_element_in(prekeys, data)
if not before_contained_key and contains_key:
@ -1879,6 +1886,9 @@ if __name__ == '__main__':
parser.add_option("--recov_outputdir", dest="recov_outputdir",
help="output directory where the recovered wallet will be put")
parser.add_option("--dont_check_walletversion", dest="dcv", action="store_true",
help="don't check if wallet version > %d before running"%max_version)
# parser.add_option("--forcerun", dest="forcerun",
# action="store_true",
# help="run even if pywallet detects bitcoin is running")