Context: re-add constructors that take params (as deprecated)

There are apps and libraries that are using these, we need to keep them as @Deprecated for
at least one release.
This commit is contained in:
Sean Gilligan 2022-07-29 07:01:11 -07:00 committed by Andreas Schildbach
parent 56419ded8e
commit e078421edd

View file

@ -61,6 +61,15 @@ public class Context {
this(DEFAULT_EVENT_HORIZON, Transaction.DEFAULT_TX_FEE, true);
}
/**
* 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.
*
@ -77,6 +86,15 @@ 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)}
*/
@Deprecated
public Context(NetworkParameters params, int eventHorizon, Coin feePerKb, boolean ensureMinRequiredFee) {
this(eventHorizon, feePerKb, ensureMinRequiredFee);
}
private static volatile Context lastConstructed;
private static boolean isStrictMode;
private static final ThreadLocal<Context> slot = new ThreadLocal<>();
@ -136,6 +154,15 @@ 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