Instant.ofEpochSecond(bitcoinPeerGroup.getFastCatchupTimeSecs())); Instant.ofEpochSecond(bitcoinPeerGroup.getFastCatchupTimeSecs())); LOG.info("Downloading SPV blockchain...");
@Test public void testWalletCatchupTime() throws Exception { // Check the fast catchup time was initialized to something around the current runtime minus a week. // The wallet was already added to the peer in setup. final int WEEK = 86400 * 7; final long now = Utils.currentTimeSeconds(); peerGroup.start(); assertTrue(peerGroup.getFastCatchupTimeSecs() > now - WEEK - 10000); Wallet w2 = new Wallet(PARAMS); ECKey key1 = new ECKey(); key1.setCreationTimeSeconds(now - 86400); // One day ago. w2.importKey(key1); peerGroup.addWallet(w2); peerGroup.waitForJobQueue(); assertEquals(peerGroup.getFastCatchupTimeSecs(), now - 86400 - WEEK); // Adding a key to the wallet should update the fast catchup time, but asynchronously and in the background // due to the need to avoid complicated lock inversions. ECKey key2 = new ECKey(); key2.setCreationTimeSeconds(now - 100000); w2.importKey(key2); peerGroup.waitForJobQueue(); assertEquals(peerGroup.getFastCatchupTimeSecs(), now - WEEK - 100000); }