Fix restoreheights prior to 2014 (#723)

* fix pre-2014 dates
* update heights
This commit is contained in:
m2049r 2021-03-10 19:29:10 +01:00 committed by GitHub
parent 12706119d3
commit 2b34454214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -378,7 +378,7 @@ public class GenerateFragment extends Fragment {
}
private long getHeight() {
long height = 0;
long height = -1;
String restoreHeight = etWalletRestoreHeight.getEditText().getText().toString().trim();
if (restoreHeight.isEmpty()) return -1;
@ -389,7 +389,7 @@ public class GenerateFragment extends Fragment {
height = RestoreHeight.getInstance().getHeight(parser.parse(restoreHeight));
} catch (ParseException ex) {
}
if ((height <= 0) && (restoreHeight.length() == 8))
if ((height < 0) && (restoreHeight.length() == 8))
try {
// is it a date without dashes?
SimpleDateFormat parser = new SimpleDateFormat("yyyyMMdd");
@ -397,7 +397,7 @@ public class GenerateFragment extends Fragment {
height = RestoreHeight.getInstance().getHeight(parser.parse(restoreHeight));
} catch (ParseException ex) {
}
if (height <= 0)
if (height < 0)
try {
// or is it a height?
height = Long.parseLong(restoreHeight);

View File

@ -121,6 +121,10 @@ public class RestoreHeight {
blockheight.put("2020-09-01", 2176790L);
blockheight.put("2020-10-01", 2198370L);
blockheight.put("2020-11-01", 2220670L);
blockheight.put("2020-12-01", 2242241L);
blockheight.put("2021-01-01", 2264584L);
blockheight.put("2021-02-01", 2286892L);
blockheight.put("2021-03-01", 2307079L);
}
public long getHeight(String date) {