Context: remove deprecated methods that take NetworkParameters

This commit is contained in:
Andreas Schildbach 2024-09-02 20:11:33 +02:00
parent 3daf1692ad
commit 89bc342f9f

View File

@ -24,7 +24,6 @@ import org.slf4j.LoggerFactory;
import java.util.Objects;
// TODO: Finish adding Context c'tors to all the different objects so we can start deprecating the versions that take NetworkParameters.
// TODO: Add a working directory notion to Context and make various subsystems that want to use files default to that directory (e.g. Orchid, block stores, wallet, etc).
// TODO: Auto-register the block chain object here, and then use it in the (newly deprecated) TransactionConfidence.getDepthInBlocks() method: the new version should take an AbstractBlockChain specifically.
// Also use the block chain object reference from the context in PeerGroup and remove the other constructors, as it's easy to forget to wire things up.
@ -56,21 +55,12 @@ public class Context {
/**
* Creates a new context object. For now, this will be done for you by the framework. Eventually you will be
* expected to do this yourself in the same manner as fetching a NetworkParameters object (at the start of your app).
* expected to do this yourself.
*/
public Context() {
this(DEFAULT_EVENT_HORIZON, Transaction.DEFAULT_TX_FEE, true, false);
}
/**
* Note that NetworkParameters have been removed from this class. Thus, this constructor just swallows them.
* @deprecated Use {@link Context#Context()}
*/
@Deprecated
public Context(NetworkParameters params) {
this();
}
/**
* Creates a new custom context object. This is mainly meant for unit tests for now.
*
@ -89,15 +79,6 @@ public class Context {
lastConstructed = this;
}
/**
* Note that NetworkParameters have been removed from this class. Thus, this constructor just swallows them.
* @deprecated Use {@link Context#Context(int, Coin, boolean, boolean)}
*/
@Deprecated
public Context(NetworkParameters params, int eventHorizon, Coin feePerKb, boolean ensureMinRequiredFee) {
this(eventHorizon, feePerKb, ensureMinRequiredFee, false);
}
private static volatile Context lastConstructed;
private static boolean isStrictMode;
private static final ThreadLocal<Context> slot = new ThreadLocal<>();
@ -157,15 +138,6 @@ public class Context {
return context;
}
/**
* Note that NetworkParameters have been removed from this class. Thus, this method just swallows them.
* @deprecated Use {@link Context#getOrCreate()}
*/
@Deprecated
public static Context getOrCreate(NetworkParameters params) {
return getOrCreate();
}
/**
* Sets the given context as the current thread context. You should use this if you create your own threads that
* want to create core BitcoinJ objects. Generally, if a class can accept a Context in its constructor and might