mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-14 11:15:51 +00:00
Wallet: Remove several methods that were deprecated long ago.
This also removes WalletEventListener and its implementations.
This commit is contained in:
parent
4971d3fc25
commit
752b06043c
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.bitcoinj.jni;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.ECKey;
|
||||
import org.bitcoinj.core.Transaction;
|
||||
import org.bitcoinj.script.Script;
|
||||
import org.bitcoinj.wallet.Wallet;
|
||||
import org.bitcoinj.wallet.listeners.WalletEventListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An event listener that relays events to a native C++ object. A pointer to that object is stored in
|
||||
* this class using JNI on the native side, thus several instances of this can point to different actual
|
||||
* native implementations.
|
||||
*/
|
||||
public class NativeWalletEventListener implements WalletEventListener {
|
||||
public long ptr;
|
||||
|
||||
@Override
|
||||
public native void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance);
|
||||
|
||||
@Override
|
||||
public native void onCoinsSent(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance);
|
||||
|
||||
@Override
|
||||
public native void onReorganize(Wallet wallet);
|
||||
|
||||
@Override
|
||||
public native void onTransactionConfidenceChanged(Wallet wallet, Transaction tx);
|
||||
|
||||
@Override
|
||||
public native void onWalletChanged(Wallet wallet);
|
||||
|
||||
@Override
|
||||
public native void onKeysAdded(List<ECKey> keys);
|
||||
|
||||
@Override
|
||||
public native void onScriptsChanged(Wallet wallet, List<Script> scripts, boolean isAddingScripts);
|
||||
}
|
@ -67,7 +67,6 @@ import org.bitcoinj.wallet.listeners.ScriptsChangeEventListener;
|
||||
import org.bitcoinj.wallet.listeners.WalletChangeEventListener;
|
||||
import org.bitcoinj.wallet.listeners.WalletCoinsReceivedEventListener;
|
||||
import org.bitcoinj.wallet.listeners.WalletCoinsSentEventListener;
|
||||
import org.bitcoinj.wallet.listeners.WalletEventListener;
|
||||
import org.bitcoinj.wallet.listeners.WalletReorganizeEventListener;
|
||||
import org.slf4j.*;
|
||||
import org.spongycastle.crypto.params.*;
|
||||
@ -692,23 +691,6 @@ public class Wallet extends BaseTaggableObject
|
||||
public LegacyAddress currentChangeAddress() {
|
||||
return currentAddress(KeyChain.KeyPurpose.CHANGE);
|
||||
}
|
||||
/**
|
||||
* @deprecated use {@link #currentChangeAddress()} instead.
|
||||
*/
|
||||
public LegacyAddress getChangeAddress() {
|
||||
return currentChangeAddress();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Deprecated alias for {@link #importKey(ECKey)}.</p>
|
||||
*
|
||||
* <p><b>Replace with either {@link #freshReceiveKey()} if your call is addKey(new ECKey()), or with {@link #importKey(ECKey)}
|
||||
* which does the same thing this method used to, but with a better name.</b></p>
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean addKey(ECKey key) {
|
||||
return importKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Imports the given ECKey to the wallet.</p>
|
||||
@ -720,12 +702,6 @@ public class Wallet extends BaseTaggableObject
|
||||
return importKeys(Lists.newArrayList(key)) == 1;
|
||||
}
|
||||
|
||||
/** Replace with {@link #importKeys(java.util.List)}, which does the same thing but with a better name. */
|
||||
@Deprecated
|
||||
public int addKeys(List<ECKey> keys) {
|
||||
return importKeys(keys);
|
||||
}
|
||||
|
||||
/**
|
||||
* Imports the given keys to the wallet.
|
||||
* If {@link Wallet#autosaveToFile(java.io.File, long, java.util.concurrent.TimeUnit, org.bitcoinj.wallet.WalletFiles.Listener)}
|
||||
@ -2563,32 +2539,6 @@ public class Wallet extends BaseTaggableObject
|
||||
|
||||
//region Event listeners
|
||||
|
||||
/**
|
||||
* Adds an event listener object. Methods on this object are called when something interesting happens,
|
||||
* like receiving money. Runs the listener methods in the user thread.
|
||||
*/
|
||||
public void addEventListener(WalletEventListener listener) {
|
||||
addChangeEventListener(Threading.USER_THREAD, listener);
|
||||
addCoinsReceivedEventListener(Threading.USER_THREAD, listener);
|
||||
addCoinsSentEventListener(Threading.USER_THREAD, listener);
|
||||
addKeyChainEventListener(Threading.USER_THREAD, listener);
|
||||
addReorganizeEventListener(Threading.USER_THREAD, listener);
|
||||
addScriptChangeEventListener(Threading.USER_THREAD, listener);
|
||||
addTransactionConfidenceEventListener(Threading.USER_THREAD, listener);
|
||||
}
|
||||
|
||||
/** Use the more specific listener methods instead */
|
||||
@Deprecated
|
||||
public void addEventListener(WalletEventListener listener, Executor executor) {
|
||||
addCoinsReceivedEventListener(executor, listener);
|
||||
addCoinsSentEventListener(executor, listener);
|
||||
addChangeEventListener(executor, listener);
|
||||
addKeyChainEventListener(executor, listener);
|
||||
addReorganizeEventListener(executor, listener);
|
||||
addScriptChangeEventListener(executor, listener);
|
||||
addTransactionConfidenceEventListener(executor, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener object. Methods on this object are called when something interesting happens,
|
||||
* like receiving money. Runs the listener methods in the user thread.
|
||||
@ -2707,21 +2657,6 @@ public class Wallet extends BaseTaggableObject
|
||||
transactionConfidenceListeners.add(new ListenerRegistration<>(listener, executor));
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the given event listener object. Returns true if the listener was removed, false if that listener
|
||||
* was never added.
|
||||
* @deprecated use the fine-grain event listeners instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean removeEventListener(WalletEventListener listener) {
|
||||
return removeChangeEventListener(listener) ||
|
||||
removeCoinsReceivedEventListener(listener) ||
|
||||
removeCoinsSentEventListener(listener) ||
|
||||
removeKeyChainEventListener(listener) ||
|
||||
removeReorganizeEventListener(listener) ||
|
||||
removeTransactionConfidenceEventListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the given event listener object. Returns true if the listener was removed, false if that listener
|
||||
* was never added.
|
||||
@ -3029,7 +2964,7 @@ public class Wallet extends BaseTaggableObject
|
||||
|
||||
/**
|
||||
* Prepares the wallet for a blockchain replay. Removes all transactions (as they would get in the way of the
|
||||
* replay) and makes the wallet think it has never seen a block. {@link WalletEventListener#onWalletChanged} will
|
||||
* replay) and makes the wallet think it has never seen a block. {@link WalletChangeEventListener#onWalletChanged} will
|
||||
* be fired.
|
||||
*/
|
||||
public void reset() {
|
||||
@ -3540,18 +3475,6 @@ public class Wallet extends BaseTaggableObject
|
||||
AVAILABLE_SPENDABLE
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link #getBalance()} instead as including watched balances is now the default behaviour */
|
||||
@Deprecated
|
||||
public Coin getWatchedBalance() {
|
||||
return getBalance();
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link #getBalance(CoinSelector)} instead as including watched balances is now the default behaviour */
|
||||
@Deprecated
|
||||
public Coin getWatchedBalance(CoinSelector selector) {
|
||||
return getBalance(selector);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the AVAILABLE balance of this wallet. See {@link BalanceType#AVAILABLE} for details on what this
|
||||
* means.
|
||||
@ -4177,12 +4100,6 @@ public class Wallet extends BaseTaggableObject
|
||||
return calculateAllSpendCandidates(true, true);
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link #calculateAllSpendCandidates(boolean, boolean)} or the zero-parameter form instead. */
|
||||
@Deprecated
|
||||
public List<TransactionOutput> calculateAllSpendCandidates(boolean excludeImmatureCoinbases) {
|
||||
return calculateAllSpendCandidates(excludeImmatureCoinbases, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all outputs that are being tracked by this wallet either from the {@link UTXOProvider}
|
||||
* (in this case the existence or not of private keys is ignored), or the wallets internal storage (the default)
|
||||
@ -5126,12 +5043,6 @@ public class Wallet extends BaseTaggableObject
|
||||
return time != 0 && key.getCreationTimeSeconds() < time;
|
||||
}
|
||||
|
||||
/** @deprecated Renamed to doMaintenance */
|
||||
@Deprecated
|
||||
public ListenableFuture<List<Transaction>> maybeDoMaintenance(@Nullable KeyParameter aesKey, boolean andSend) throws DeterministicUpgradeRequiresPassword {
|
||||
return doMaintenance(aesKey, andSend);
|
||||
}
|
||||
|
||||
/**
|
||||
* A wallet app should call this from time to time in order to let the wallet craft and send transactions needed
|
||||
* to re-organise coins internally. A good time to call this would be after receiving coins for an unencrypted
|
||||
|
@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.bitcoinj.wallet.listeners;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.ECKey;
|
||||
import org.bitcoinj.core.Transaction;
|
||||
import org.bitcoinj.script.Script;
|
||||
import org.bitcoinj.wallet.Wallet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Deprecated: implement the more specific event listener interfaces instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class AbstractWalletEventListener extends AbstractKeyChainEventListener implements WalletEventListener {
|
||||
@Override
|
||||
public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
||||
onChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCoinsSent(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
||||
onChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReorganize(Wallet wallet) {
|
||||
onChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransactionConfidenceChanged(Wallet wallet, Transaction tx) {
|
||||
onChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeysAdded(List<ECKey> keys) {
|
||||
onChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScriptsChanged(Wallet wallet, List<Script> scripts, boolean isAddingScripts) {
|
||||
onChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalletChanged(Wallet wallet) {
|
||||
onChange();
|
||||
}
|
||||
|
||||
/**
|
||||
* Default method called on change events.
|
||||
*/
|
||||
public void onChange() {
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>Implementors are called when the contents of the wallet changes, for instance due to receiving/sending money
|
||||
* or a block chain re-organize. It may be convenient to derive from {@link AbstractWalletEventListener} instead.</p>
|
||||
* or a block chain re-organize.</p>
|
||||
*/
|
||||
public interface ScriptsChangeEventListener {
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ import org.bitcoinj.wallet.Wallet;
|
||||
|
||||
/**
|
||||
* <p>Implementors are called when the contents of the wallet changes, for instance due to receiving/sending money
|
||||
* or a block chain re-organize. It may be convenient to derive from {@link AbstractWalletEventListener} instead.</p>
|
||||
* or a block chain re-organize.</p>
|
||||
*/
|
||||
public interface WalletChangeEventListener {
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@ import org.bitcoinj.wallet.Wallet;
|
||||
|
||||
/**
|
||||
* <p>Implementors are called when the contents of the wallet changes, for instance due to receiving/sending money
|
||||
* or a block chain re-organize. It may be convenient to derive from {@link AbstractWalletEventListener} instead.</p>
|
||||
* or a block chain re-organize.</p>
|
||||
*/
|
||||
public interface WalletCoinsReceivedEventListener {
|
||||
/**
|
||||
|
@ -22,7 +22,7 @@ import org.bitcoinj.wallet.Wallet;
|
||||
|
||||
/**
|
||||
* <p>Implementors are called when the contents of the wallet changes, for instance due to receiving/sending money
|
||||
* or a block chain re-organize. It may be convenient to derive from {@link AbstractWalletEventListener} instead.</p>
|
||||
* or a block chain re-organize.</p>
|
||||
*/
|
||||
public interface WalletCoinsSentEventListener {
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.bitcoinj.wallet.listeners;
|
||||
|
||||
import org.bitcoinj.core.listeners.TransactionConfidenceEventListener;
|
||||
|
||||
/**
|
||||
* <p>Common interface for wallet changes and transactions.</p>
|
||||
* @deprecated Use the superinterfaces directly instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface WalletEventListener extends
|
||||
KeyChainEventListener, WalletChangeEventListener,
|
||||
WalletCoinsReceivedEventListener, WalletCoinsSentEventListener,
|
||||
WalletReorganizeEventListener, ScriptsChangeEventListener,
|
||||
TransactionConfidenceEventListener {
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user