From 551ea9ac3c133450ea1dfb944fb113b8f1f6edb8 Mon Sep 17 00:00:00 2001 From: jackjack Date: Mon, 19 Dec 2011 14:25:42 +0100 Subject: [PATCH] Add slush's fix to avoid crashing on corrupted sectors and --dont_check_walletversion option --- pywallet.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pywallet.py b/pywallet.py index 28a2929..358bba6 100755 --- a/pywallet.py +++ b/pywallet.py @@ -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")