mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2024-11-19 01:40:26 +01:00
core: remove deprecated methods that take instants or duration as long and TimeUnit
This commit is contained in:
parent
bc7883ef8f
commit
3daf1692ad
@ -230,24 +230,6 @@ public class Block extends BaseMessage {
|
|||||||
null;
|
null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct a block initialized with all the given fields.
|
|
||||||
* @param version This should usually be set to 1 or 2, depending on if the height is in the coinbase input.
|
|
||||||
* @param prevBlockHash Reference to previous block in the chain or {@link Sha256Hash#ZERO_HASH} if genesis.
|
|
||||||
* @param merkleRoot The root of the merkle tree formed by the transactions.
|
|
||||||
* @param time UNIX time seconds when the block was mined.
|
|
||||||
* @param difficultyTarget Number which this block hashes lower than.
|
|
||||||
* @param nonce Arbitrary number to make the block hash lower than the target.
|
|
||||||
* @param transactions List of transactions including the coinbase, or {@code null} for header-only blocks
|
|
||||||
* @deprecated use {@link #Block(long, Sha256Hash, Sha256Hash, Instant, long, long, List)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public Block(long version, Sha256Hash prevBlockHash, Sha256Hash merkleRoot, long time,
|
|
||||||
long difficultyTarget, long nonce, @Nullable List<Transaction> transactions) {
|
|
||||||
this(version, prevBlockHash, merkleRoot, Instant.ofEpochSecond(time), difficultyTarget, nonce,
|
|
||||||
transactions);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Block createGenesis(Instant time, long difficultyTarget) {
|
public static Block createGenesis(Instant time, long difficultyTarget) {
|
||||||
return new Block(BLOCK_VERSION_GENESIS, time, difficultyTarget, genesisTransactions());
|
return new Block(BLOCK_VERSION_GENESIS, time, difficultyTarget, genesisTransactions());
|
||||||
}
|
}
|
||||||
|
@ -166,12 +166,6 @@ public class CheckpointManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #getCheckpointBefore(Instant)} */
|
|
||||||
@Deprecated
|
|
||||||
public StoredBlock getCheckpointBefore(long timeSecs) {
|
|
||||||
return getCheckpointBefore(Instant.ofEpochSecond(timeSecs));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the number of checkpoints that were loaded. */
|
/** Returns the number of checkpoints that were loaded. */
|
||||||
public int numCheckpoints() {
|
public int numCheckpoints() {
|
||||||
return checkpoints.size();
|
return checkpoints.size();
|
||||||
@ -207,11 +201,4 @@ public class CheckpointManager {
|
|||||||
store.put(checkpoint);
|
store.put(checkpoint);
|
||||||
store.setChainHead(checkpoint);
|
store.setChainHead(checkpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #checkpoint(NetworkParameters, InputStream, BlockStore, Instant)} */
|
|
||||||
@Deprecated
|
|
||||||
public static void checkpoint(NetworkParameters params, InputStream checkpoints, BlockStore store, long timeSecs)
|
|
||||||
throws IOException, BlockStoreException {
|
|
||||||
checkpoint(params, checkpoints, store, Instant.ofEpochSecond(timeSecs));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1354,15 +1354,6 @@ public class Peer extends PeerSocketHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #setDownloadParameters(boolean)} or {@link #setFastDownloadParameters(boolean, Instant)} */
|
|
||||||
@Deprecated
|
|
||||||
public void setDownloadParameters(long fastCatchupTimeSecs, boolean useFilteredBlocks) {
|
|
||||||
if (fastCatchupTimeSecs > 0)
|
|
||||||
setFastDownloadParameters(useFilteredBlocks, Instant.ofEpochSecond(fastCatchupTimeSecs));
|
|
||||||
else
|
|
||||||
setDownloadParameters(useFilteredBlocks);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Links the given wallet to this peer. If you have multiple peers, you should use a {@link PeerGroup} to manage
|
* Links the given wallet to this peer. If you have multiple peers, you should use a {@link PeerGroup} to manage
|
||||||
* them and use the {@link PeerGroup#addWallet(Wallet)} method instead of registering the wallet with each peer
|
* them and use the {@link PeerGroup#addWallet(Wallet)} method instead of registering the wallet with each peer
|
||||||
|
@ -414,12 +414,6 @@ public class PeerAddress {
|
|||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #time()} */
|
|
||||||
@Deprecated
|
|
||||||
public long getTime() {
|
|
||||||
return time.getEpochSecond();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (hostname != null) {
|
if (hostname != null) {
|
||||||
|
@ -33,13 +33,6 @@ public interface PeerFilterProvider {
|
|||||||
*/
|
*/
|
||||||
Instant earliestKeyCreationTime();
|
Instant earliestKeyCreationTime();
|
||||||
|
|
||||||
/** @deprecated use {@link #earliestKeyCreationTime()} */
|
|
||||||
@Deprecated
|
|
||||||
default long getEarliestKeyCreationTime() {
|
|
||||||
Instant earliestKeyCreationTime = earliestKeyCreationTime();
|
|
||||||
return earliestKeyCreationTime.equals(Instant.MAX) ? Long.MAX_VALUE : earliestKeyCreationTime.getEpochSecond();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called on all registered filter providers before {@link #getBloomFilterElementCount()} and
|
* Called on all registered filter providers before {@link #getBloomFilterElementCount()} and
|
||||||
* {@link #getBloomFilter(int, double, int)} are called. Once called, the provider should ensure that the items
|
* {@link #getBloomFilter(int, double, int)} are called. Once called, the provider should ensure that the items
|
||||||
|
@ -511,15 +511,6 @@ public class PeerGroup implements TransactionBroadcaster {
|
|||||||
this.vPeerDiscoveryTimeout = peerDiscoveryTimeout;
|
this.vPeerDiscoveryTimeout = peerDiscoveryTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This is how many milliseconds we wait for peer discoveries to return their results.
|
|
||||||
* @deprecated use {@link #setPeerDiscoveryTimeout(Duration)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setPeerDiscoveryTimeoutMillis(long peerDiscoveryTimeoutMillis) {
|
|
||||||
setPeerDiscoveryTimeout(Duration.ofMillis(peerDiscoveryTimeoutMillis));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjusts the desired number of connections that we will create to peers. Note that if there are already peers
|
* Adjusts the desired number of connections that we will create to peers. Note that if there are already peers
|
||||||
* open and the new value is lower than the current number of peers, those connections will be terminated. Likewise
|
* open and the new value is lower than the current number of peers, those connections will be terminated. Likewise
|
||||||
@ -1774,12 +1765,6 @@ public class PeerGroup implements TransactionBroadcaster {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #setFastCatchupTime(Instant)} */
|
|
||||||
@Deprecated
|
|
||||||
public void setFastCatchupTimeSecs(long fastCatchupTimeSecs) {
|
|
||||||
setFastCatchupTime(Instant.ofEpochSecond(fastCatchupTimeSecs));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current fast catchup time. The contents of blocks before this time won't be downloaded as they
|
* Returns the current fast catchup time. The contents of blocks before this time won't be downloaded as they
|
||||||
* cannot contain any interesting transactions. If you use {@link PeerGroup#addWallet(Wallet)} this just returns
|
* cannot contain any interesting transactions. If you use {@link PeerGroup#addWallet(Wallet)} this just returns
|
||||||
@ -1795,12 +1780,6 @@ public class PeerGroup implements TransactionBroadcaster {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #getFastCatchupTime()} */
|
|
||||||
@Deprecated
|
|
||||||
public long getFastCatchupTimeSecs() {
|
|
||||||
return getFastCatchupTime().getEpochSecond();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void handlePeerDeath(final Peer peer, @Nullable Throwable exception) {
|
protected void handlePeerDeath(final Peer peer, @Nullable Throwable exception) {
|
||||||
// Peer deaths can occur during startup if a connect attempt after peer discovery aborts immediately.
|
// Peer deaths can occur during startup if a connect attempt after peer discovery aborts immediately.
|
||||||
if (!isRunning()) return;
|
if (!isRunning()) return;
|
||||||
|
@ -44,11 +44,4 @@ public interface EncryptableItem {
|
|||||||
|
|
||||||
/** Returns the time at which this encryptable item was first created/derived, or empty of unknown. */
|
/** Returns the time at which this encryptable item was first created/derived, or empty of unknown. */
|
||||||
Optional<Instant> getCreationTime();
|
Optional<Instant> getCreationTime();
|
||||||
|
|
||||||
/** @deprecated use {@link #getCreationTime()} */
|
|
||||||
@Deprecated
|
|
||||||
default long getCreationTimeSeconds() {
|
|
||||||
Optional<Instant> creationTime = getCreationTime();
|
|
||||||
return creationTime.isPresent() ? creationTime.get().getEpochSecond() : 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,6 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import static org.bitcoinj.base.internal.Preconditions.checkState;
|
import static org.bitcoinj.base.internal.Preconditions.checkState;
|
||||||
|
@ -73,12 +73,6 @@ public class BlockingClientManager extends AbstractIdleService implements Client
|
|||||||
this.connectTimeout = connectTimeout;
|
this.connectTimeout = connectTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #setConnectTimeout(Duration)} */
|
|
||||||
@Deprecated
|
|
||||||
public void setConnectTimeoutMillis(int connectTimeoutMillis) {
|
|
||||||
setConnectTimeout(Duration.ofMillis(connectTimeoutMillis));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception { }
|
protected void startUp() throws Exception { }
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ import org.bitcoinj.core.VersionMessage;
|
|||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A PeerDiscovery object is responsible for finding addresses of other nodes in the Bitcoin P2P network. Note that
|
* A PeerDiscovery object is responsible for finding addresses of other nodes in the Bitcoin P2P network. Note that
|
||||||
@ -40,14 +39,6 @@ public interface PeerDiscovery {
|
|||||||
*/
|
*/
|
||||||
List<InetSocketAddress> getPeers(long services, Duration timeout) throws PeerDiscoveryException;
|
List<InetSocketAddress> getPeers(long services, Duration timeout) throws PeerDiscoveryException;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getPeers(long, Duration)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
default List<InetSocketAddress> getPeers(long services, long timeoutValue, TimeUnit timeoutUnit) throws PeerDiscoveryException {
|
|
||||||
return getPeers(services, Duration.ofMillis(timeoutUnit.toMillis(timeoutValue)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Stops any discovery in progress when we want to shut down quickly. */
|
/** Stops any discovery in progress when we want to shut down quickly. */
|
||||||
void shutdown();
|
void shutdown();
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ import java.time.Duration;
|
|||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.temporal.Temporal;
|
import java.time.temporal.Temporal;
|
||||||
import java.time.temporal.TemporalUnit;
|
import java.time.temporal.TemporalUnit;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import static org.bitcoinj.base.internal.Preconditions.checkState;
|
import static org.bitcoinj.base.internal.Preconditions.checkState;
|
||||||
|
|
||||||
|
@ -382,12 +382,6 @@ public class Script {
|
|||||||
return Optional.ofNullable(creationTime);
|
return Optional.ofNullable(creationTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #creationTime()} */
|
|
||||||
@Deprecated
|
|
||||||
public long getCreationTimeSeconds() {
|
|
||||||
return creationTime().orElse(Instant.EPOCH).getEpochSecond();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the program opcodes as a string, for example "[1234] DUP HASH160", or "<empty>".
|
* Returns the program opcodes as a string, for example "[1234] DUP HASH160", or "<empty>".
|
||||||
*/
|
*/
|
||||||
|
@ -277,13 +277,6 @@ public class FakeTxBuilder {
|
|||||||
return createFakeBlock(blockStore, version, time, 0, transactions);
|
return createFakeBlock(blockStore, version, time, 0, transactions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #createFakeBlock(BlockStore, long, Instant, Transaction...)} */
|
|
||||||
@Deprecated
|
|
||||||
public static BlockPair createFakeBlock(BlockStore blockStore, long version,
|
|
||||||
long timeSecs, Transaction... transactions) {
|
|
||||||
return createFakeBlock(blockStore, version, Instant.ofEpochSecond(timeSecs), transactions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Emulates receiving a valid block */
|
/** Emulates receiving a valid block */
|
||||||
public static BlockPair createFakeBlock(BlockStore blockStore, StoredBlock previousStoredBlock, long version,
|
public static BlockPair createFakeBlock(BlockStore blockStore, StoredBlock previousStoredBlock, long version,
|
||||||
Instant time, int height, Transaction... transactions) {
|
Instant time, int height, Transaction... transactions) {
|
||||||
@ -305,14 +298,6 @@ public class FakeTxBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #createFakeBlock(BlockStore, StoredBlock, long, Instant, int, Transaction...)} */
|
|
||||||
@Deprecated
|
|
||||||
public static BlockPair createFakeBlock(BlockStore blockStore, StoredBlock previousStoredBlock, long version,
|
|
||||||
long timeSecs, int height, Transaction... transactions) {
|
|
||||||
return createFakeBlock(blockStore, previousStoredBlock, version, Instant.ofEpochSecond(timeSecs), height,
|
|
||||||
transactions);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BlockPair createFakeBlock(BlockStore blockStore, StoredBlock previousStoredBlock, int height, Transaction... transactions) {
|
public static BlockPair createFakeBlock(BlockStore blockStore, StoredBlock previousStoredBlock, int height, Transaction... transactions) {
|
||||||
return createFakeBlock(blockStore, previousStoredBlock, Block.BLOCK_VERSION_BIP66, TimeUtils.currentTime(), height, transactions);
|
return createFakeBlock(blockStore, previousStoredBlock, Block.BLOCK_VERSION_BIP66, TimeUtils.currentTime(), height, transactions);
|
||||||
}
|
}
|
||||||
@ -326,12 +311,6 @@ public class FakeTxBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #createFakeBlock(BlockStore, long, Instant, int, Transaction...)} */
|
|
||||||
@Deprecated
|
|
||||||
public static BlockPair createFakeBlock(BlockStore blockStore, long version, long timeSecs, int height, Transaction... transactions) {
|
|
||||||
return createFakeBlock(blockStore, version, Instant.ofEpochSecond(timeSecs), height, transactions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Emulates receiving a valid block that builds on top of the chain. */
|
/** Emulates receiving a valid block that builds on top of the chain. */
|
||||||
public static BlockPair createFakeBlock(BlockStore blockStore, int height,
|
public static BlockPair createFakeBlock(BlockStore blockStore, int height,
|
||||||
Transaction... transactions) {
|
Transaction... transactions) {
|
||||||
|
@ -95,15 +95,6 @@ public class ExponentialBackoff implements Comparable<ExponentialBackoff> {
|
|||||||
return retryTime;
|
return retryTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the next time to retry, in milliseconds since the epoch
|
|
||||||
* @deprecated use {@link #retryTime()}
|
|
||||||
**/
|
|
||||||
@Deprecated
|
|
||||||
public long getRetryTime() {
|
|
||||||
return retryTime.toEpochMilli();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(ExponentialBackoff other) {
|
public int compareTo(ExponentialBackoff other) {
|
||||||
// note that in this implementation compareTo() is not consistent with equals()
|
// note that in this implementation compareTo() is not consistent with equals()
|
||||||
|
@ -650,13 +650,6 @@ public class BasicKeyChain implements EncryptableKeyChain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #findOldestKeyAfter(Instant)} */
|
|
||||||
@Nullable
|
|
||||||
@Deprecated
|
|
||||||
public ECKey findOldestKeyAfter(long timeSecs) {
|
|
||||||
return findOldestKeyAfter(Instant.ofEpochSecond(timeSecs)).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns a list of all ECKeys created after the given time. */
|
/** Returns a list of all ECKeys created after the given time. */
|
||||||
public List<ECKey> findKeysBefore(Instant time) {
|
public List<ECKey> findKeysBefore(Instant time) {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
@ -674,12 +667,6 @@ public class BasicKeyChain implements EncryptableKeyChain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #findKeysBefore(Instant)} */
|
|
||||||
@Deprecated
|
|
||||||
public List<ECKey> findKeysBefore(long timeSecs) {
|
|
||||||
return findKeysBefore(Instant.ofEpochSecond(timeSecs));
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString(boolean includePrivateKeys, @Nullable AesKey aesKey, Network network) {
|
public String toString(boolean includePrivateKeys, @Nullable AesKey aesKey, Network network) {
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
List<ECKey> keys = getKeys();
|
List<ECKey> keys = getKeys();
|
||||||
|
@ -219,13 +219,6 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
|||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #entropy(byte[], Instant)} */
|
|
||||||
@Deprecated
|
|
||||||
public T entropy(byte[] entropy, long creationTimeSecs) {
|
|
||||||
checkArgument(creationTimeSecs > 0);
|
|
||||||
return entropy(entropy, Instant.ofEpochSecond(creationTimeSecs));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a deterministic key chain starting from the given seed. All keys yielded by this chain will be the same
|
* Creates a deterministic key chain starting from the given seed. All keys yielded by this chain will be the same
|
||||||
* if the starting seed is the same.
|
* if the starting seed is the same.
|
||||||
|
@ -141,12 +141,6 @@ public class DeterministicSeed implements EncryptableItem {
|
|||||||
this(decodeMnemonicCode(mnemonicString), seed, passphrase, creationTime);
|
this(decodeMnemonicCode(mnemonicString), seed, passphrase, creationTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #ofMnemonic(String, String, Instant)} or {@link #ofMnemonic(String, String)} */
|
|
||||||
@Deprecated
|
|
||||||
public DeterministicSeed(String mnemonicString, byte[] seed, String passphrase, long creationTimeSecs) {
|
|
||||||
this(mnemonicString, seed, passphrase, creationTimeSecs > 0 ? Instant.ofEpochSecond(creationTimeSecs) : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Internal use only. */
|
/** Internal use only. */
|
||||||
private DeterministicSeed(byte[] seed, List<String> mnemonic, @Nullable Instant creationTime) {
|
private DeterministicSeed(byte[] seed, List<String> mnemonic, @Nullable Instant creationTime) {
|
||||||
this.seed = Objects.requireNonNull(seed);
|
this.seed = Objects.requireNonNull(seed);
|
||||||
@ -165,23 +159,11 @@ public class DeterministicSeed implements EncryptableItem {
|
|||||||
this.creationTime = creationTime;
|
this.creationTime = creationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated will be removed in a future release */
|
|
||||||
@Deprecated
|
|
||||||
public DeterministicSeed(EncryptedData encryptedMnemonic, @Nullable EncryptedData encryptedSeed, long creationTimeSecs) {
|
|
||||||
this(encryptedMnemonic, encryptedSeed, creationTimeSecs > 0 ? Instant.ofEpochSecond(creationTimeSecs) : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Internal use only. */
|
/** Internal use only. */
|
||||||
private DeterministicSeed(List<String> mnemonicCode, @Nullable byte[] seed, String passphrase, @Nullable Instant creationTime) {
|
private DeterministicSeed(List<String> mnemonicCode, @Nullable byte[] seed, String passphrase, @Nullable Instant creationTime) {
|
||||||
this((seed != null ? seed : MnemonicCode.toSeed(mnemonicCode, Objects.requireNonNull(passphrase))), mnemonicCode, creationTime);
|
this((seed != null ? seed : MnemonicCode.toSeed(mnemonicCode, Objects.requireNonNull(passphrase))), mnemonicCode, creationTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #ofMnemonic(List, String, Instant)} or {@link #ofMnemonic(List, String)} */
|
|
||||||
@Deprecated
|
|
||||||
public DeterministicSeed(List<String> mnemonicCode, @Nullable byte[] seed, String passphrase, long creationTimeSecs) {
|
|
||||||
this(mnemonicCode, seed, passphrase, creationTimeSecs > 0 ? Instant.ofEpochSecond(creationTimeSecs) : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @deprecated use {@link #ofRandom(SecureRandom, int, String)} */
|
/** @deprecated use {@link #ofRandom(SecureRandom, int, String)} */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DeterministicSeed(SecureRandom random, int bits, String passphrase) {
|
public DeterministicSeed(SecureRandom random, int bits, String passphrase) {
|
||||||
@ -200,12 +182,6 @@ public class DeterministicSeed implements EncryptableItem {
|
|||||||
this.creationTime = creationTime;
|
this.creationTime = creationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #ofEntropy(byte[], String, Instant)} or {@link #ofEntropy(byte[], String)} */
|
|
||||||
@Deprecated
|
|
||||||
public DeterministicSeed(byte[] entropy, String passphrase, long creationTimeSecs) {
|
|
||||||
this(entropy, passphrase, creationTimeSecs > 0 ? Instant.ofEpochSecond(creationTimeSecs) : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static byte[] getEntropy(SecureRandom random, int bits) {
|
private static byte[] getEntropy(SecureRandom random, int bits) {
|
||||||
checkArgument(bits <= MAX_SEED_ENTROPY_BITS, () ->
|
checkArgument(bits <= MAX_SEED_ENTROPY_BITS, () ->
|
||||||
"requested entropy size too large");
|
"requested entropy size too large");
|
||||||
@ -291,17 +267,6 @@ public class DeterministicSeed implements EncryptableItem {
|
|||||||
this.creationTime = null;
|
this.creationTime = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #setCreationTime(Instant)} */
|
|
||||||
@Deprecated
|
|
||||||
public void setCreationTimeSeconds(long creationTimeSecs) {
|
|
||||||
if (creationTimeSecs > 0)
|
|
||||||
setCreationTime(Instant.ofEpochSecond(creationTimeSecs));
|
|
||||||
else if (creationTimeSecs == 0)
|
|
||||||
clearCreationTime();
|
|
||||||
else
|
|
||||||
throw new IllegalArgumentException("Cannot set creation time to negative value: " + creationTimeSecs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DeterministicSeed encrypt(KeyCrypter keyCrypter, AesKey aesKey) {
|
public DeterministicSeed encrypt(KeyCrypter keyCrypter, AesKey aesKey) {
|
||||||
checkState(encryptedMnemonicCode == null, () ->
|
checkState(encryptedMnemonicCode == null, () ->
|
||||||
"trying to encrypt seed twice");
|
"trying to encrypt seed twice");
|
||||||
|
@ -57,12 +57,6 @@ public class KeyTimeCoinSelector implements CoinSelector {
|
|||||||
this.ignorePending = ignorePending;
|
this.ignorePending = ignorePending;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #KeyTimeCoinSelector(Wallet, Instant, boolean)} */
|
|
||||||
@Deprecated
|
|
||||||
public KeyTimeCoinSelector(Wallet wallet, long timeSecs, boolean ignorePending) {
|
|
||||||
this(wallet, Instant.ofEpochSecond(timeSecs), ignorePending);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CoinSelection select(Coin target, List<TransactionOutput> candidates) {
|
public CoinSelection select(Coin target, List<TransactionOutput> candidates) {
|
||||||
try {
|
try {
|
||||||
|
@ -134,7 +134,6 @@ import java.util.TreeSet;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -497,16 +496,6 @@ public class Wallet extends BaseTaggableObject
|
|||||||
return fromWatchingKeyB58(params.network(), watchKeyB58);
|
return fromWatchingKeyB58(params.network(), watchKeyB58);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #fromWatchingKeyB58(Network, String, Instant)} or {@link #fromWatchingKeyB58(Network, String)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static Wallet fromWatchingKeyB58(NetworkParameters params, String watchKeyB58, long creationTimeSeconds) {
|
|
||||||
return (creationTimeSeconds == 0)
|
|
||||||
? fromWatchingKeyB58(params.network(), watchKeyB58)
|
|
||||||
: fromWatchingKeyB58(params.network(), watchKeyB58, Instant.ofEpochSecond(creationTimeSeconds));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a wallet that tracks payments to and from the HD key hierarchy rooted by the given spending key. This HAS
|
* Creates a wallet that tracks payments to and from the HD key hierarchy rooted by the given spending key. This HAS
|
||||||
* to be an account key as returned by {@link DeterministicKeyChain#getWatchingKey()}. This wallet can also spend.
|
* to be an account key as returned by {@link DeterministicKeyChain#getWatchingKey()}. This wallet can also spend.
|
||||||
@ -570,16 +559,6 @@ public class Wallet extends BaseTaggableObject
|
|||||||
return fromSpendingKeyB58(params.network(), spendingKeyB58);
|
return fromSpendingKeyB58(params.network(), spendingKeyB58);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #fromSpendingKeyB58(Network, String, Instant)} or {@link #fromSpendingKeyB58(Network, String)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static Wallet fromSpendingKeyB58(NetworkParameters params, String spendingKeyB58, long creationTimeSeconds) {
|
|
||||||
return (creationTimeSeconds == 0)
|
|
||||||
? fromSpendingKeyB58(params.network(), spendingKeyB58)
|
|
||||||
: fromSpendingKeyB58(params.network(), spendingKeyB58, Instant.ofEpochSecond(creationTimeSeconds));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a spending wallet that tracks payments to and from a BIP32-style HD key hierarchy rooted by {@code masterKey} and
|
* Creates a spending wallet that tracks payments to and from a BIP32-style HD key hierarchy rooted by {@code masterKey} and
|
||||||
* {@code accountNumber}. The account path must be directly below the master key as in BIP-32.
|
* {@code accountNumber}. The account path must be directly below the master key as in BIP-32.
|
||||||
@ -1189,14 +1168,6 @@ public class Wallet extends BaseTaggableObject
|
|||||||
return addWatchedAddresses(Collections.singletonList(address), creationTime) == 1;
|
return addWatchedAddresses(Collections.singletonList(address), creationTime) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #addWatchedAddress(Address, Instant)} or {@link #addWatchedAddress(Address)} */
|
|
||||||
@Deprecated
|
|
||||||
public boolean addWatchedAddress(final Address address, long creationTime) {
|
|
||||||
return creationTime > 0 ?
|
|
||||||
addWatchedAddress(address, Instant.ofEpochSecond(creationTime)) :
|
|
||||||
addWatchedAddress(address);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the given addresses to the wallet to be watched. Outputs can be retrieved
|
* Adds the given addresses to the wallet to be watched. Outputs can be retrieved
|
||||||
* by {@link #getWatchedOutputs(boolean)}.
|
* by {@link #getWatchedOutputs(boolean)}.
|
||||||
@ -1228,14 +1199,6 @@ public class Wallet extends BaseTaggableObject
|
|||||||
return addWatchedScripts(scripts);
|
return addWatchedScripts(scripts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #addWatchedAddresses(List, Instant)} or {@link #addWatchedAddresses(List)} */
|
|
||||||
@Deprecated
|
|
||||||
public int addWatchedAddresses(final List<Address> addresses, long creationTime) {
|
|
||||||
return creationTime > 0 ?
|
|
||||||
addWatchedAddresses(addresses, creationTime) :
|
|
||||||
addWatchedAddresses(addresses);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the given output scripts to the wallet to be watched. Outputs can be retrieved by {@link #getWatchedOutputs(boolean)}.
|
* Adds the given output scripts to the wallet to be watched. Outputs can be retrieved by {@link #getWatchedOutputs(boolean)}.
|
||||||
* If a script is already being watched, the object is replaced with the one in the given list. As {@link Script}
|
* If a script is already being watched, the object is replaced with the one in the given list. As {@link Script}
|
||||||
@ -1859,12 +1822,6 @@ public class Wallet extends BaseTaggableObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #autosaveToFile(File, Duration, WalletFiles.Listener)} */
|
|
||||||
@Deprecated
|
|
||||||
public WalletFiles autosaveToFile(File f, long delayTime, TimeUnit timeUnit, @Nullable WalletFiles.Listener eventListener) {
|
|
||||||
return autosaveToFile(f, Duration.ofMillis(timeUnit.toMillis(delayTime)), eventListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Disables auto-saving, after it had been enabled with
|
* Disables auto-saving, after it had been enabled with
|
||||||
@ -3855,13 +3812,6 @@ public class Wallet extends BaseTaggableObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #setLastBlockSeenTime(Instant)} or {@link #clearLastBlockSeenTime()} */
|
|
||||||
@Deprecated
|
|
||||||
public void setLastBlockSeenTimeSecs(long timeSecs) {
|
|
||||||
checkArgument(timeSecs > 0);
|
|
||||||
setLastBlockSeenTime(Instant.ofEpochSecond(timeSecs));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns time extracted from the last best seen block header, or empty. This timestamp
|
* Returns time extracted from the last best seen block header, or empty. This timestamp
|
||||||
* is <b>not</b> the local time at which the block was first observed by this application but rather what the block
|
* is <b>not</b> the local time at which the block was first observed by this application but rather what the block
|
||||||
@ -3878,12 +3828,6 @@ public class Wallet extends BaseTaggableObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #lastBlockSeenTime()} */
|
|
||||||
@Deprecated
|
|
||||||
public long getLastBlockSeenTimeSecs() {
|
|
||||||
return lastBlockSeenTime().map(Instant::getEpochSecond).orElse((long) 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the height of the last seen best-chain block. Can be 0 if a wallet is brand new or -1 if the wallet
|
* Returns the height of the last seen best-chain block. Can be 0 if a wallet is brand new or -1 if the wallet
|
||||||
* is old and doesn't have that data.
|
* is old and doesn't have that data.
|
||||||
@ -5667,15 +5611,6 @@ public class Wallet extends BaseTaggableObject
|
|||||||
saveNow();
|
saveNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #setKeyRotationTime(Instant)} */
|
|
||||||
@Deprecated
|
|
||||||
public void setKeyRotationTime(long timeSecs) {
|
|
||||||
if (timeSecs == 0)
|
|
||||||
setKeyRotationTime((Instant) null);
|
|
||||||
else
|
|
||||||
setKeyRotationTime(Instant.ofEpochSecond(timeSecs));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the key rotation time, or empty if unconfigured. See {@link #setKeyRotationTime(Instant)} for a description
|
* Returns the key rotation time, or empty if unconfigured. See {@link #setKeyRotationTime(Instant)} for a description
|
||||||
* of the field.
|
* of the field.
|
||||||
|
@ -104,12 +104,6 @@ public class WalletFiles {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link #WalletFiles(Wallet, File, Duration)} */
|
|
||||||
@Deprecated
|
|
||||||
public WalletFiles(final Wallet wallet, File file, long delayTime, TimeUnit timeUnit) {
|
|
||||||
this(wallet, file, Duration.ofMillis(timeUnit.toMillis(delayTime)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get the {@link Wallet} this {@link WalletFiles} is managing. */
|
/** Get the {@link Wallet} this {@link WalletFiles} is managing. */
|
||||||
public Wallet getWallet() {
|
public Wallet getWallet() {
|
||||||
return wallet;
|
return wallet;
|
||||||
|
@ -22,7 +22,6 @@ import org.junit.Test;
|
|||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotEquals;
|
import static org.junit.Assert.assertNotEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
Loading…
Reference in New Issue
Block a user