add logging when event wallet id is not present
package com.sparrowwallet.sparrow.event;
import com.sparrowwallet.sparrow.io.Config;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public class StorageEvent extends TimedEvent {
+ private static final Logger log = LoggerFactory.getLogger(StorageEvent.class);
+
private static boolean firstRunDone = false;
private static final Map<String, Long> eventTime = new HashMap<>();
@@ -22,8 +26,10 @@ public class StorageEvent extends TimedEvent {
eventTime.put(walletId, System.currentTimeMillis());
timeMills = keyDerivationPeriod;
} else if(action == Action.END) {
- long start = eventTime.get(walletId);
- if(firstRunDone) {
+ Long start = eventTime.get(walletId);
+ if(start == null) {
+ log.error("Could not find start event time for wallet id " + walletId);
+ } else if(firstRunDone) {
keyDerivationPeriod = (int)(System.currentTimeMillis() - start);
Config.get().setKeyDerivationPeriod(keyDerivationPeriod);
}
