mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-18 21:32:35 +01:00
PeerFilterProvider: rename earliestKeyCreationTime()
method from getEarliestKeyCreationTimeInstant()
This commit is contained in:
parent
ed716bc4ba
commit
5db4e1eadd
@ -31,12 +31,12 @@ public interface PeerFilterProvider {
|
||||
* Blocks with timestamps before this time will only have headers downloaded. {@link Instant#EPOCH} requires that all
|
||||
* blocks be downloaded, and thus this should default to {@link Instant#MAX}.
|
||||
*/
|
||||
Instant getEarliestKeyCreationTimeInstant();
|
||||
Instant earliestKeyCreationTime();
|
||||
|
||||
/** @deprecated use {@link #getEarliestKeyCreationTimeInstant()} */
|
||||
/** @deprecated use {@link #earliestKeyCreationTime()} */
|
||||
@Deprecated
|
||||
default long getEarliestKeyCreationTime() {
|
||||
Instant earliestKeyCreationTime = getEarliestKeyCreationTimeInstant();
|
||||
Instant earliestKeyCreationTime = earliestKeyCreationTime();
|
||||
return earliestKeyCreationTime.equals(Instant.MAX) ? Long.MAX_VALUE : earliestKeyCreationTime.getEpochSecond();
|
||||
}
|
||||
|
||||
|
@ -353,7 +353,7 @@ public class WalletAppKit extends AbstractIdleService {
|
||||
}
|
||||
else
|
||||
{
|
||||
time = vWallet.getEarliestKeyCreationTimeInstant();
|
||||
time = vWallet.earliestKeyCreationTime();
|
||||
}
|
||||
if (time.isAfter(Instant.EPOCH))
|
||||
CheckpointManager.checkpoint(params, checkpoints, vStore, time);
|
||||
|
@ -75,7 +75,7 @@ public class FilterMerger {
|
||||
result.earliestKeyTime = Instant.MAX;
|
||||
int elements = 0;
|
||||
for (PeerFilterProvider p : providers) {
|
||||
result.earliestKeyTime = TimeUtils.earlier(result.earliestKeyTime, p.getEarliestKeyCreationTimeInstant());
|
||||
result.earliestKeyTime = TimeUtils.earlier(result.earliestKeyTime, p.earliestKeyCreationTime());
|
||||
elements += p.getBloomFilterElementCount();
|
||||
}
|
||||
|
||||
|
@ -3531,7 +3531,7 @@ public class Wallet extends BaseTaggableObject
|
||||
|
||||
// Do the keys.
|
||||
builder.append("\nKeys:\n");
|
||||
builder.append("Earliest creation time: ").append(TimeUtils.dateTimeFormat(getEarliestKeyCreationTimeInstant()))
|
||||
builder.append("Earliest creation time: ").append(TimeUtils.dateTimeFormat(earliestKeyCreationTime()))
|
||||
.append('\n');
|
||||
final Optional<Instant> keyRotationTime = getKeyRotationTimeInstant();
|
||||
if (keyRotationTime.isPresent())
|
||||
@ -3635,7 +3635,7 @@ public class Wallet extends BaseTaggableObject
|
||||
* {@link Instant#MAX} if no keys in this wallet
|
||||
*/
|
||||
@Override
|
||||
public Instant getEarliestKeyCreationTimeInstant() {
|
||||
public Instant earliestKeyCreationTime() {
|
||||
keyChainGroupLock.lock();
|
||||
try {
|
||||
Instant earliestTime = keyChainGroup.getEarliestKeyCreationTimeInstant();
|
||||
|
@ -357,9 +357,9 @@ public class WalletProtobufSerializerTest {
|
||||
assertEquals(creationTime, wallet.getWatchingKey().getCreationTime().get());
|
||||
assertEquals(creationTime, wallet2.getWatchingKey().getCreationTime().get());
|
||||
assertEquals(creationTime, wallet3.getWatchingKey().getCreationTime().get());
|
||||
assertEquals(creationTime, wallet.getEarliestKeyCreationTimeInstant());
|
||||
assertEquals(creationTime, wallet2.getEarliestKeyCreationTimeInstant());
|
||||
assertEquals(creationTime, wallet3.getEarliestKeyCreationTimeInstant());
|
||||
assertEquals(creationTime, wallet.earliestKeyCreationTime());
|
||||
assertEquals(creationTime, wallet2.earliestKeyCreationTime());
|
||||
assertEquals(creationTime, wallet3.earliestKeyCreationTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1481,10 +1481,10 @@ public class WalletTest extends TestWithWallet {
|
||||
Instant now = TimeUtils.currentTime().truncatedTo(ChronoUnit.SECONDS);
|
||||
TimeUtils.setMockClock(now);
|
||||
wallet = Wallet.createDeterministic(TESTNET, ScriptType.P2PKH);
|
||||
assertEquals(now, wallet.getEarliestKeyCreationTimeInstant());
|
||||
assertEquals(now, wallet.earliestKeyCreationTime());
|
||||
TimeUtils.rollMockClock(Duration.ofMinutes(1));
|
||||
wallet.freshReceiveKey();
|
||||
assertEquals(now, wallet.getEarliestKeyCreationTimeInstant());
|
||||
assertEquals(now, wallet.earliestKeyCreationTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -1492,11 +1492,11 @@ public class WalletTest extends TestWithWallet {
|
||||
Instant now = TimeUtils.currentTime().truncatedTo(ChronoUnit.SECONDS);
|
||||
TimeUtils.setMockClock(now);
|
||||
wallet = Wallet.createDeterministic(TESTNET, ScriptType.P2PKH);
|
||||
assertEquals(now, wallet.getEarliestKeyCreationTimeInstant());
|
||||
assertEquals(now, wallet.earliestKeyCreationTime());
|
||||
TimeUtils.rollMockClock(Duration.ofMinutes(-2));
|
||||
wallet.addWatchedAddress(OTHER_ADDRESS);
|
||||
wallet.freshReceiveKey();
|
||||
assertEquals(now.minusSeconds(120), wallet.getEarliestKeyCreationTimeInstant());
|
||||
assertEquals(now.minusSeconds(120), wallet.earliestKeyCreationTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -3534,7 +3534,7 @@ public class WalletTest extends TestWithWallet {
|
||||
Wallet wallet = Wallet.createDeterministic(TESTNET, ScriptType.P2WPKH);
|
||||
List<String> mnemonicCode = wallet.getKeyChainSeed().getMnemonicCode();
|
||||
final DeterministicSeed clonedSeed = DeterministicSeed.ofMnemonic(mnemonicCode, "",
|
||||
wallet.getEarliestKeyCreationTimeInstant());
|
||||
wallet.earliestKeyCreationTime());
|
||||
Wallet clone = Wallet.fromSeed(TESTNET, clonedSeed, ScriptType.P2WPKH);
|
||||
assertEquals(wallet.currentReceiveKey(), clone.currentReceiveKey());
|
||||
assertEquals(wallet.freshReceiveAddress(ScriptType.P2PKH),
|
||||
|
@ -991,7 +991,7 @@ public class WalletTool implements Callable<Integer> {
|
||||
if (reset) {
|
||||
try {
|
||||
CheckpointManager.checkpoint(params, CheckpointManager.openStream(params), store,
|
||||
wallet.getEarliestKeyCreationTimeInstant());
|
||||
wallet.earliestKeyCreationTime());
|
||||
StoredBlock head = store.getChainHead();
|
||||
System.out.println("Skipped to checkpoint " + head.getHeight() + " at "
|
||||
+ TimeUtils.dateTimeFormat(head.getHeader().time()));
|
||||
|
Loading…
Reference in New Issue
Block a user