mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-02 21:47:18 +00:00
Wallet: flip argument ordering in deprecated Wallet.addEventListener to restore compatibility with 0.13
This commit is contained in:
@@ -1064,7 +1064,7 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
checkState(!wallets.contains(wallet));
|
||||
wallets.add(wallet);
|
||||
wallet.setTransactionBroadcaster(this);
|
||||
wallet.addEventListener(Threading.SAME_THREAD, walletEventListener);
|
||||
wallet.addEventListener(walletEventListener, Threading.SAME_THREAD);
|
||||
addPeerFilterProvider(wallet);
|
||||
for (Peer peer : peers) {
|
||||
peer.addWallet(wallet);
|
||||
|
||||
@@ -2338,11 +2338,9 @@ public class Wallet extends BaseTaggableObject
|
||||
coinListeners.add(new ListenerRegistration<WalletCoinEventListener>(listener, executor));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener object. Methods on this object are called when something interesting happens,
|
||||
* like receiving money. The listener is executed by the given executor.
|
||||
*/
|
||||
public void addEventListener(Executor executor, WalletEventListener listener) {
|
||||
/** Use the more specific listener methods instead */
|
||||
@Deprecated
|
||||
public void addEventListener(WalletEventListener listener, Executor executor) {
|
||||
addCoinEventListener(executor, listener);
|
||||
addChangeEventListener(executor, listener);
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public class PaymentChannelClientState {
|
||||
if (storedChannel != null && storedChannel.close != null) {
|
||||
watchCloseConfirmations();
|
||||
}
|
||||
wallet.addEventListener(Threading.SAME_THREAD, new AbstractWalletEventListener() {
|
||||
wallet.addEventListener(new AbstractWalletEventListener() {
|
||||
@Override
|
||||
public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
||||
synchronized (PaymentChannelClientState.this) {
|
||||
@@ -189,7 +189,7 @@ public class PaymentChannelClientState {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}, Threading.SAME_THREAD);
|
||||
}
|
||||
|
||||
private void watchCloseConfirmations() {
|
||||
|
||||
@@ -557,12 +557,12 @@ public class ChainSplitTest {
|
||||
// transactions would be. Also check that a dead coinbase on a sidechain is resurrected if the sidechain
|
||||
// becomes the best chain once more. Finally, check that dependent transactions are killed recursively.
|
||||
final ArrayList<Transaction> txns = new ArrayList<Transaction>(3);
|
||||
wallet.addEventListener(Threading.SAME_THREAD, new AbstractWalletEventListener() {
|
||||
wallet.addEventListener(new AbstractWalletEventListener() {
|
||||
@Override
|
||||
public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
||||
txns.add(tx);
|
||||
}
|
||||
});
|
||||
}, Threading.SAME_THREAD);
|
||||
|
||||
Block b1 = unitTestParams.getGenesisBlock().createNextBlock(someOtherGuy);
|
||||
final ECKey coinsTo2 = wallet.freshReceiveKey();
|
||||
|
||||
@@ -3015,12 +3015,12 @@ public class WalletTest extends TestWithWallet {
|
||||
// Check that we can register an event listener, generate some keys and the callbacks are invoked properly.
|
||||
wallet = new Wallet(params);
|
||||
final List<ECKey> keys = Lists.newLinkedList();
|
||||
wallet.addEventListener(Threading.SAME_THREAD, new AbstractWalletEventListener() {
|
||||
wallet.addEventListener(new AbstractWalletEventListener() {
|
||||
@Override
|
||||
public void onKeysAdded(List<ECKey> k) {
|
||||
keys.addAll(k);
|
||||
}
|
||||
});
|
||||
}, Threading.SAME_THREAD);
|
||||
wallet.freshReceiveKey();
|
||||
assertEquals(1, keys.size());
|
||||
}
|
||||
|
||||
@@ -28,15 +28,13 @@ public class BitcoinUIModel {
|
||||
}
|
||||
|
||||
public void setWallet(Wallet wallet) {
|
||||
wallet.addEventListener(Platform::runLater,
|
||||
new AbstractWalletEventListener() {
|
||||
@Override
|
||||
public void onWalletChanged(Wallet wallet) {
|
||||
super.onWalletChanged(wallet);
|
||||
update(wallet);
|
||||
}
|
||||
wallet.addEventListener(new AbstractWalletEventListener() {
|
||||
@Override
|
||||
public void onWalletChanged(Wallet wallet) {
|
||||
super.onWalletChanged(wallet);
|
||||
update(wallet);
|
||||
}
|
||||
);
|
||||
}, Platform::runLater);
|
||||
update(wallet);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user