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));
|
checkState(!wallets.contains(wallet));
|
||||||
wallets.add(wallet);
|
wallets.add(wallet);
|
||||||
wallet.setTransactionBroadcaster(this);
|
wallet.setTransactionBroadcaster(this);
|
||||||
wallet.addEventListener(Threading.SAME_THREAD, walletEventListener);
|
wallet.addEventListener(walletEventListener, Threading.SAME_THREAD);
|
||||||
addPeerFilterProvider(wallet);
|
addPeerFilterProvider(wallet);
|
||||||
for (Peer peer : peers) {
|
for (Peer peer : peers) {
|
||||||
peer.addWallet(wallet);
|
peer.addWallet(wallet);
|
||||||
|
|||||||
@@ -2338,11 +2338,9 @@ public class Wallet extends BaseTaggableObject
|
|||||||
coinListeners.add(new ListenerRegistration<WalletCoinEventListener>(listener, executor));
|
coinListeners.add(new ListenerRegistration<WalletCoinEventListener>(listener, executor));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Use the more specific listener methods instead */
|
||||||
* Adds an event listener object. Methods on this object are called when something interesting happens,
|
@Deprecated
|
||||||
* like receiving money. The listener is executed by the given executor.
|
public void addEventListener(WalletEventListener listener, Executor executor) {
|
||||||
*/
|
|
||||||
public void addEventListener(Executor executor, WalletEventListener listener) {
|
|
||||||
addCoinEventListener(executor, listener);
|
addCoinEventListener(executor, listener);
|
||||||
addChangeEventListener(executor, listener);
|
addChangeEventListener(executor, listener);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ public class PaymentChannelClientState {
|
|||||||
if (storedChannel != null && storedChannel.close != null) {
|
if (storedChannel != null && storedChannel.close != null) {
|
||||||
watchCloseConfirmations();
|
watchCloseConfirmations();
|
||||||
}
|
}
|
||||||
wallet.addEventListener(Threading.SAME_THREAD, new AbstractWalletEventListener() {
|
wallet.addEventListener(new AbstractWalletEventListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
||||||
synchronized (PaymentChannelClientState.this) {
|
synchronized (PaymentChannelClientState.this) {
|
||||||
@@ -189,7 +189,7 @@ public class PaymentChannelClientState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}, Threading.SAME_THREAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void watchCloseConfirmations() {
|
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
|
// 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.
|
// becomes the best chain once more. Finally, check that dependent transactions are killed recursively.
|
||||||
final ArrayList<Transaction> txns = new ArrayList<Transaction>(3);
|
final ArrayList<Transaction> txns = new ArrayList<Transaction>(3);
|
||||||
wallet.addEventListener(Threading.SAME_THREAD, new AbstractWalletEventListener() {
|
wallet.addEventListener(new AbstractWalletEventListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
||||||
txns.add(tx);
|
txns.add(tx);
|
||||||
}
|
}
|
||||||
});
|
}, Threading.SAME_THREAD);
|
||||||
|
|
||||||
Block b1 = unitTestParams.getGenesisBlock().createNextBlock(someOtherGuy);
|
Block b1 = unitTestParams.getGenesisBlock().createNextBlock(someOtherGuy);
|
||||||
final ECKey coinsTo2 = wallet.freshReceiveKey();
|
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.
|
// Check that we can register an event listener, generate some keys and the callbacks are invoked properly.
|
||||||
wallet = new Wallet(params);
|
wallet = new Wallet(params);
|
||||||
final List<ECKey> keys = Lists.newLinkedList();
|
final List<ECKey> keys = Lists.newLinkedList();
|
||||||
wallet.addEventListener(Threading.SAME_THREAD, new AbstractWalletEventListener() {
|
wallet.addEventListener(new AbstractWalletEventListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onKeysAdded(List<ECKey> k) {
|
public void onKeysAdded(List<ECKey> k) {
|
||||||
keys.addAll(k);
|
keys.addAll(k);
|
||||||
}
|
}
|
||||||
});
|
}, Threading.SAME_THREAD);
|
||||||
wallet.freshReceiveKey();
|
wallet.freshReceiveKey();
|
||||||
assertEquals(1, keys.size());
|
assertEquals(1, keys.size());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,15 +28,13 @@ public class BitcoinUIModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setWallet(Wallet wallet) {
|
public void setWallet(Wallet wallet) {
|
||||||
wallet.addEventListener(Platform::runLater,
|
wallet.addEventListener(new AbstractWalletEventListener() {
|
||||||
new AbstractWalletEventListener() {
|
@Override
|
||||||
@Override
|
public void onWalletChanged(Wallet wallet) {
|
||||||
public void onWalletChanged(Wallet wallet) {
|
super.onWalletChanged(wallet);
|
||||||
super.onWalletChanged(wallet);
|
update(wallet);
|
||||||
update(wallet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
}, Platform::runLater);
|
||||||
update(wallet);
|
update(wallet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user