cormorant: default to existing descriptor timestamp when extending range

This commit is contained in:
Craig Raw 2023-11-30 08:50:20 +02:00
parent 6072f6d31a
commit 675b7ed4f8

View file

@ -330,8 +330,7 @@ public class BitcoindClient {
ScanDate scanDate = entry.getValue(); ScanDate scanDate = entry.getValue();
ScanDate importedScanDate = importedDescriptors.get(entry.getKey()); ScanDate importedScanDate = importedDescriptors.get(entry.getKey());
if(scanDate.range != null && importedScanDate != null && importedScanDate.range != null && scanDate.range > importedScanDate.range) { if(scanDate.range != null && importedScanDate != null && importedScanDate.range != null && scanDate.range > importedScanDate.range) {
Date rescanSince = scanDate.rescanSince != null && (importedScanDate.rescanSince == null || scanDate.rescanSince.before(importedScanDate.rescanSince)) ? scanDate.rescanSince : importedScanDate.rescanSince; importingDescriptors.put(entry.getKey(), new ScanDate(importedScanDate.rescanSince == null || scanDate.forceRescan ? scanDate.rescanSince : importedScanDate.rescanSince, scanDate.range, false));
importingDescriptors.put(entry.getKey(), new ScanDate(rescanSince, scanDate.range, false));
} else if(scanDate.forceRescan) { } else if(scanDate.forceRescan) {
if(scanDate.rescanSince != null && (importedScanDate == null || importedScanDate.rescanSince == null || scanDate.rescanSince.before(importedScanDate.rescanSince))) { if(scanDate.rescanSince != null && (importedScanDate == null || importedScanDate.rescanSince == null || scanDate.rescanSince.before(importedScanDate.rescanSince))) {
importingDescriptors.put(entry.getKey(), new ScanDate(scanDate.rescanSince, importedScanDate != null ? importedScanDate.range : scanDate.range, false)); importingDescriptors.put(entry.getKey(), new ScanDate(scanDate.rescanSince, importedScanDate != null ? importedScanDate.range : scanDate.range, false));