mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-10 09:20:04 +01:00
PeerGroup: rename fastCatchupTime()
method from getFastCatchupTime()
This commit is contained in:
parent
c2cabead9a
commit
45f87d8339
2 changed files with 6 additions and 6 deletions
|
@ -1763,7 +1763,7 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||||
* the min of the wallets earliest key times.
|
* the min of the wallets earliest key times.
|
||||||
* @return a time in seconds since the epoch
|
* @return a time in seconds since the epoch
|
||||||
*/
|
*/
|
||||||
public Instant getFastCatchupTime() {
|
public Instant fastCatchupTime() {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
return fastCatchupTime;
|
return fastCatchupTime;
|
||||||
|
@ -1772,10 +1772,10 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #getFastCatchupTime()} */
|
/** @deprecated use {@link #fastCatchupTime()} */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public long getFastCatchupTimeSecs() {
|
public long getFastCatchupTimeSecs() {
|
||||||
return getFastCatchupTime().getEpochSecond();
|
return fastCatchupTime().getEpochSecond();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handlePeerDeath(final Peer peer, @Nullable Throwable exception) {
|
protected void handlePeerDeath(final Peer peer, @Nullable Throwable exception) {
|
||||||
|
|
|
@ -433,21 +433,21 @@ public class PeerGroupTest extends TestWithPeerGroup {
|
||||||
final int WEEK = 86400 * 7;
|
final int WEEK = 86400 * 7;
|
||||||
final Instant now = TimeUtils.currentTime().truncatedTo(ChronoUnit.SECONDS);
|
final Instant now = TimeUtils.currentTime().truncatedTo(ChronoUnit.SECONDS);
|
||||||
peerGroup.start();
|
peerGroup.start();
|
||||||
assertTrue(peerGroup.getFastCatchupTime().isAfter(now.minusSeconds(WEEK).minusSeconds(10000)));
|
assertTrue(peerGroup.fastCatchupTime().isAfter(now.minusSeconds(WEEK).minusSeconds(10000)));
|
||||||
Wallet w2 = Wallet.createDeterministic(UNITTEST, ScriptType.P2PKH);
|
Wallet w2 = Wallet.createDeterministic(UNITTEST, ScriptType.P2PKH);
|
||||||
ECKey key1 = new ECKey();
|
ECKey key1 = new ECKey();
|
||||||
key1.setCreationTime(now.minus(1, ChronoUnit.DAYS)); // One day ago.
|
key1.setCreationTime(now.minus(1, ChronoUnit.DAYS)); // One day ago.
|
||||||
w2.importKey(key1);
|
w2.importKey(key1);
|
||||||
peerGroup.addWallet(w2);
|
peerGroup.addWallet(w2);
|
||||||
peerGroup.waitForJobQueue();
|
peerGroup.waitForJobQueue();
|
||||||
assertEquals(peerGroup.getFastCatchupTime(), now.minusSeconds(86400).minusSeconds(WEEK));
|
assertEquals(peerGroup.fastCatchupTime(), now.minusSeconds(86400).minusSeconds(WEEK));
|
||||||
// Adding a key to the wallet should update the fast catchup time, but asynchronously and in the background
|
// 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.
|
// due to the need to avoid complicated lock inversions.
|
||||||
ECKey key2 = new ECKey();
|
ECKey key2 = new ECKey();
|
||||||
key2.setCreationTime(now.minusSeconds(100000));
|
key2.setCreationTime(now.minusSeconds(100000));
|
||||||
w2.importKey(key2);
|
w2.importKey(key2);
|
||||||
peerGroup.waitForJobQueue();
|
peerGroup.waitForJobQueue();
|
||||||
assertEquals(peerGroup.getFastCatchupTime(),now.minusSeconds(WEEK).minusSeconds(100000));
|
assertEquals(peerGroup.fastCatchupTime(),now.minusSeconds(WEEK).minusSeconds(100000));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Add table
Reference in a new issue