mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-13 10:45:51 +00:00
Watch out for scripts with a creation time of zero (and warn the developer about them via logging).
This commit is contained in:
parent
eb15ded065
commit
4471709693
@ -216,6 +216,9 @@ public class CheckpointManager {
|
||||
|
||||
time -= 86400 * 7;
|
||||
|
||||
checkArgument(time > 0);
|
||||
log.info("Attempting to initialize a new block store with a checkpoint for time {}", time);
|
||||
|
||||
BufferedInputStream stream = new BufferedInputStream(checkpoints);
|
||||
CheckpointManager manager = new CheckpointManager(params, stream);
|
||||
StoredBlock checkpoint = manager.getCheckpointBefore(time);
|
||||
|
@ -823,6 +823,8 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
||||
try {
|
||||
for (final Script script : scripts) {
|
||||
if (watchedScripts.contains(script)) continue;
|
||||
if (script.getCreationTimeSeconds() == 0)
|
||||
log.warn("Adding a script to the wallet with a creation time of zero, this will disable the checkpointing optimization! {}", script);
|
||||
watchedScripts.add(script);
|
||||
added++;
|
||||
}
|
||||
|
@ -295,7 +295,10 @@ public class WalletAppKit extends AbstractIdleService {
|
||||
} else {
|
||||
time = vWallet.getEarliestKeyCreationTime();
|
||||
}
|
||||
CheckpointManager.checkpoint(params, checkpoints, vStore, time);
|
||||
if (time > 0)
|
||||
CheckpointManager.checkpoint(params, checkpoints, vStore, time);
|
||||
else
|
||||
log.warn("Creating a new uncheckpointed block store due to a wallet with a creation time of zero: this will result in a very slow chain sync");
|
||||
} else if (chainFileExists) {
|
||||
log.info("Deleting the chain file in preparation from restore.");
|
||||
vStore.close();
|
||||
|
Loading…
x
Reference in New Issue
Block a user