mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-19 05:33:44 +01:00
PeerGroup: rename getFastCatchupTime()
method from fastCatchupTime()
This effectively reverts commit 45f87d8339
.
This commit is contained in:
parent
781d64550b
commit
ff42c49648
@ -1786,7 +1786,7 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
* the min of the wallets earliest key times.
|
||||
* @return a time in seconds since the epoch
|
||||
*/
|
||||
public Instant fastCatchupTime() {
|
||||
public Instant getFastCatchupTime() {
|
||||
lock.lock();
|
||||
try {
|
||||
return fastCatchupTime;
|
||||
@ -1795,10 +1795,10 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated use {@link #fastCatchupTime()} */
|
||||
/** @deprecated use {@link #getFastCatchupTime()} */
|
||||
@Deprecated
|
||||
public long getFastCatchupTimeSecs() {
|
||||
return fastCatchupTime().getEpochSecond();
|
||||
return getFastCatchupTime().getEpochSecond();
|
||||
}
|
||||
|
||||
protected void handlePeerDeath(final Peer peer, @Nullable Throwable exception) {
|
||||
|
@ -427,21 +427,21 @@ public class PeerGroupTest extends TestWithPeerGroup {
|
||||
final int WEEK = 86400 * 7;
|
||||
final Instant now = TimeUtils.currentTime().truncatedTo(ChronoUnit.SECONDS);
|
||||
peerGroup.start();
|
||||
assertTrue(peerGroup.fastCatchupTime().isAfter(now.minusSeconds(WEEK).minusSeconds(10000)));
|
||||
assertTrue(peerGroup.getFastCatchupTime().isAfter(now.minusSeconds(WEEK).minusSeconds(10000)));
|
||||
Wallet w2 = Wallet.createDeterministic(UNITTEST.network(), ScriptType.P2PKH);
|
||||
ECKey key1 = new ECKey();
|
||||
key1.setCreationTime(now.minus(1, ChronoUnit.DAYS)); // One day ago.
|
||||
w2.importKey(key1);
|
||||
peerGroup.addWallet(w2);
|
||||
peerGroup.waitForJobQueue();
|
||||
assertEquals(peerGroup.fastCatchupTime(), now.minusSeconds(86400).minusSeconds(WEEK));
|
||||
assertEquals(peerGroup.getFastCatchupTime(), now.minusSeconds(86400).minusSeconds(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.setCreationTime(now.minusSeconds(100000));
|
||||
w2.importKey(key2);
|
||||
peerGroup.waitForJobQueue();
|
||||
assertEquals(peerGroup.fastCatchupTime(),now.minusSeconds(WEEK).minusSeconds(100000));
|
||||
assertEquals(peerGroup.getFastCatchupTime(),now.minusSeconds(WEEK).minusSeconds(100000));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user