Commit 3d3dd6f7 authored by Ross Nicoll's avatar Ross Nicoll Committed by Andreas Schildbach

Split peer event listeners into single method interfaces

parent 76c16b41
......@@ -19,8 +19,6 @@ package org.bitcoinj.core;
import com.google.common.annotations.*;
import com.google.common.base.*;
import com.google.common.util.concurrent.*;
import org.bitcoinj.core.listeners.AbstractPeerDataEventListener;
import org.bitcoinj.core.listeners.PeerDataEventListener;
import org.bitcoinj.utils.*;
import org.slf4j.*;
......@@ -29,6 +27,7 @@ import java.util.*;
import java.util.concurrent.*;
import static com.google.common.base.Preconditions.checkState;
import org.bitcoinj.core.listeners.PreMessageReceivedEventListener;
/**
* Represents a single transaction broadcast that we are performing. A broadcast occurs after a new transaction is created
......@@ -88,7 +87,7 @@ public class TransactionBroadcast {
this.minConnections = minConnections;
}
private PeerDataEventListener rejectionListener = new AbstractPeerDataEventListener() {
private PreMessageReceivedEventListener rejectionListener = new PreMessageReceivedEventListener() {
@Override
public Message onPreMessageReceived(Peer peer, Message m) {
if (m instanceof RejectMessage) {
......@@ -100,7 +99,7 @@ public class TransactionBroadcast {
if (size > threshold) {
log.warn("Threshold for considering broadcast rejected has been reached ({}/{})", size, threshold);
future.setException(new RejectedTransactionException(tx, rejectMessage));
peerGroup.removeDataEventListener(this);
peerGroup.removePreMessageReceivedEventListener(this);
}
}
}
......@@ -109,7 +108,7 @@ public class TransactionBroadcast {
};
public ListenableFuture<Transaction> broadcast() {
peerGroup.addDataEventListener(Threading.SAME_THREAD, rejectionListener);
peerGroup.addPreMessageReceivedEventListener(Threading.SAME_THREAD, rejectionListener);
log.info("Waiting for {} peers required for broadcast, we have {} ...", minConnections, peerGroup.getConnectedPeers().size());
peerGroup.waitForPeers(minConnections).addListener(new EnoughAvailablePeers(), Threading.SAME_THREAD);
return future;
......@@ -161,7 +160,7 @@ public class TransactionBroadcast {
// So we just have to assume we're done, at that point. This happens when we're not given
// any peer discovery source and the user just calls connectTo() once.
if (minConnections == 1) {
peerGroup.removeDataEventListener(rejectionListener);
peerGroup.removePreMessageReceivedEventListener(rejectionListener);
future.set(tx);
}
}
......@@ -197,7 +196,7 @@ public class TransactionBroadcast {
// We're done! It's important that the PeerGroup lock is not held (by this thread) at this
// point to avoid triggering inversions when the Future completes.
log.info("broadcastTransaction: {} complete", tx.getHash());
peerGroup.removeDataEventListener(rejectionListener);
peerGroup.removePreMessageReceivedEventListener(rejectionListener);
conf.removeEventListener(this);
future.set(tx); // RE-ENTRANCY POINT
}
......
/**
* 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.core.listeners;
import org.bitcoinj.core.*;
import javax.annotation.*;
/**
* <p>Implementors can listen to events like blocks being downloaded/transactions being broadcast/connect/disconnects,
* they can pre-filter messages before they are procesesed by a {@link Peer} or {@link PeerGroup}, and they can
* provide transactions to remote peers when they ask for them.</p>
*/
public interface BlocksDownloadedEventListener {
// TODO: Fix the Block/FilteredBlock type hierarchy so we can avoid the stupid typeless API here.
/**
* <p>Called on a Peer thread when a block is received.</p>
*
* <p>The block may be a Block object that contains transactions, a Block object that is only a header when
* fast catchup is being used. If set, filteredBlock can be used to retrieve the list of associated transactions.</p>
*
* @param peer the peer receiving the block
* @param block the downloaded block
* @param filteredBlock if non-null, the object that wraps the block header passed as the block param.
* @param blocksLeft the number of blocks left to download
*/
void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft);
}
/**
* 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.core.listeners;
import org.bitcoinj.core.*;
/**
* <p>Implementors can listen to events like blocks being downloaded/transactions being broadcast/connect/disconnects,
* they can pre-filter messages before they are procesesed by a {@link Peer} or {@link PeerGroup}, and they can
* provide transactions to remote peers when they ask for them.</p>
*/
public interface ChainDownloadStartedEventListener {
/**
* Called when a download is started with the initial number of blocks to be downloaded.
*
* @param peer the peer receiving the block
* @param blocksLeft the number of blocks left to download
*/
void onChainDownloadStarted(Peer peer, int blocksLeft);
}
/**
* 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.core.listeners;
import org.bitcoinj.core.*;
import javax.annotation.*;
import java.util.*;
/**
* <p>Implementors can listen to events like blocks being downloaded/transactions being broadcast/connect/disconnects,
* they can pre-filter messages before they are procesesed by a {@link Peer} or {@link PeerGroup}, and they can
* provide transactions to remote peers when they ask for them.</p>
*/
public interface GetDataEventListener {
/**
* <p>Called when a peer receives a getdata message, usually in response to an "inv" being broadcast. Return as many
* items as possible which appear in the {@link GetDataMessage}, or null if you're not interested in responding.</p>
*
* <p>Note that this will never be called if registered with any executor other than
* {@link org.bitcoinj.utils.Threading#SAME_THREAD}</p>
*/
@Nullable
List<Message> getData(Peer peer, GetDataMessage m);
}
......@@ -25,8 +25,8 @@ public interface NewBestBlockListener {
/**
* Called when a new block on the best chain is seen, after relevant
* transactions are extracted and sent to us via either
* {@link ReceiveFromBlockListener#receiveFromBlock(Transaction, StoredBlock, org.bitcoinj.core.BlockChain.NewBlockType, int)}
* or {@link TransactionIsInBlockListener#notifyTransactionIsInBlock(Sha256Hash, StoredBlock, org.bitcoinj.core.BlockChain.NewBlockType, int)}.
* {@link TransactionReceivedInBlockListener#receiveFromBlock(org.bitcoinj.core.Transaction, org.bitcoinj.core.StoredBlock, org.bitcoinj.core.BlockChain.NewBlockType, int relativityOffset)}
* or {@link TransactionReceivedInBlockListener#notifyTransactionIsInBlock(org.bitcoinj.core.Sha256Hash, org.bitcoinj.core.StoredBlock, org.bitcoinj.core.BlockChain.NewBlockType, int)}.
* If this block is causing a re-organise to a new chain, this method is NOT
* called even though the block may be the new best block: your reorganize
* implementation is expected to do whatever would normally be done do for a
......
......@@ -18,56 +18,11 @@ package org.bitcoinj.core.listeners;
import org.bitcoinj.core.*;
import javax.annotation.*;
import java.util.*;
/**
* <p>Implementors can listen to events like blocks being downloaded/transactions being broadcast/connect/disconnects,
* they can pre-filter messages before they are processed by a {@link Peer} or {@link PeerGroup}, and they can
* provide transactions to remote peers when they ask for them.</p>
*/
public interface PeerDataEventListener {
// TODO: Fix the Block/FilteredBlock type hierarchy so we can avoid the stupid typeless API here.
/**
* <p>Called on a Peer thread when a block is received.</p>
*
* <p>The block may be a Block object that contains transactions, a Block object that is only a header when
* fast catchup is being used. If set, filteredBlock can be used to retrieve the list of associated transactions.</p>
*
* @param peer the peer receiving the block
* @param block the downloaded block
* @param filteredBlock if non-null, the object that wraps the block header passed as the block param.
* @param blocksLeft the number of blocks left to download
*/
void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft);
/**
* Called when a download is started with the initial number of blocks to be downloaded.
*
* @param peer the peer receiving the block
* @param blocksLeft the number of blocks left to download
*/
void onChainDownloadStarted(Peer peer, int blocksLeft);
/**
* <p>Called when a message is received by a peer, before the message is processed. The returned message is
* processed instead. Returning null will cause the message to be ignored by the Peer returning the same message
* object allows you to see the messages received but not change them. The result from one event listeners
* callback is passed as "m" to the next, forming a chain.</p>
*
* <p>Note that this will never be called if registered with any executor other than
* {@link org.bitcoinj.utils.Threading#SAME_THREAD}</p>
*/
Message onPreMessageReceived(Peer peer, Message m);
/**
* <p>Called when a peer receives a getdata message, usually in response to an "inv" being broadcast. Return as many
* items as possible which appear in the {@link GetDataMessage}, or null if you're not interested in responding.</p>
*
* <p>Note that this will never be called if registered with any executor other than
* {@link org.bitcoinj.utils.Threading#SAME_THREAD}</p>
*/
@Nullable
List<Message> getData(Peer peer, GetDataMessage m);
public interface PeerDataEventListener extends BlocksDownloadedEventListener, ChainDownloadStartedEventListener,
GetDataEventListener, PreMessageReceivedEventListener {
}
/**
* 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.core.listeners;
import org.bitcoinj.core.*;
/**
* <p>Implementors can listen to events like blocks being downloaded/transactions being broadcast/connect/disconnects,
* they can pre-filter messages before they are procesesed by a {@link Peer} or {@link PeerGroup}, and they can
* provide transactions to remote peers when they ask for them.</p>
*/
public interface PreMessageReceivedEventListener {
/**
* <p>Called when a message is received by a peer, before the message is processed. The returned message is
* processed instead. Returning null will cause the message to be ignored by the Peer returning the same message
* object allows you to see the messages received but not change them. The result from one event listeners
* callback is passed as "m" to the next, forming a chain.</p>
*
* <p>Note that this will never be called if registered with any executor other than
* {@link org.bitcoinj.utils.Threading#SAME_THREAD}</p>
*/
Message onPreMessageReceived(Peer peer, Message m);
}
......@@ -25,7 +25,8 @@ import org.bitcoinj.core.VerificationException;
public interface ReorganizeListener {
/**
* Called by the {@link BlockChain} when the best chain (representing total work done) has changed. In this case,
* Called by the {@link org.bitcoinj.core.BlockChain} when the best chain
* (representing total work done) has changed. In this case,
* we need to go through our transactions and find out if any have become invalid. It's possible for our balance
* to go down in this case: money we thought we had can suddenly vanish if the rest of the network agrees it
* should be so.<p>
......
......@@ -20,11 +20,9 @@ package org.bitcoinj.kits;
import com.google.common.collect.*;
import com.google.common.util.concurrent.*;
import com.subgraph.orchid.*;
import org.bitcoinj.core.listeners.DownloadProgressTracker;
import org.bitcoinj.core.listeners.PeerDataEventListener;
import org.bitcoinj.core.listeners.*;
import org.bitcoinj.core.*;
import org.bitcoinj.net.discovery.*;
import org.bitcoinj.params.*;
import org.bitcoinj.protocols.channels.*;
import org.bitcoinj.store.*;
import org.bitcoinj.wallet.*;
......@@ -76,7 +74,7 @@ public class WalletAppKit extends AbstractIdleService {
protected boolean useAutoSave = true;
protected PeerAddress[] peerAddresses;
protected PeerDataEventListener downloadListener;
protected DownloadProgressTracker downloadListener;
protected boolean autoStop = true;
protected InputStream checkpoints;
protected boolean blockingStartup = true;
......@@ -135,7 +133,7 @@ public class WalletAppKit extends AbstractIdleService {
* {@link org.bitcoinj.core.DownloadProgressTracker} is a good choice. This has no effect unless setBlockingStartup(false) has been called
* too, due to some missing implementation code.
*/
public WalletAppKit setDownloadListener(PeerDataEventListener listener) {
public WalletAppKit setDownloadListener(DownloadProgressTracker listener) {
this.downloadListener = listener;
return this;
}
......@@ -341,7 +339,7 @@ public class WalletAppKit extends AbstractIdleService {
@Override
public void onSuccess(@Nullable Object result) {
completeExtensionInitiations(vPeerGroup);
final PeerDataEventListener l = downloadListener == null ? new DownloadProgressTracker() : downloadListener;
final DownloadProgressTracker l = downloadListener == null ? new DownloadProgressTracker() : downloadListener;
vPeerGroup.startBlockChainDownload(l);
}
......
......@@ -87,7 +87,7 @@ public class BitcoindComparisonTool {
final Set<Sha256Hash> blocksPendingSend = Collections.synchronizedSet(new HashSet<Sha256Hash>());
final AtomicInteger unexpectedInvs = new AtomicInteger(0);
final SettableFuture<Void> connectedFuture = SettableFuture.create();
final AbstractPeerEventListener listener = new AbstractPeerEventListener() {
final PeerConnectionEventListener listener = new PeerConnectionEventListener() {
@Override
public void onPeerConnected(Peer peer, int peerCount) {
if (!peer.getPeerVersionMessage().subVer.contains("Satoshi")) {
......@@ -114,6 +114,13 @@ public class BitcoindComparisonTool {
System.exit(1);
}
@Override
public void onPeersDiscovered(Set<PeerAddress> peerAddresses) {
// Ignore
}
};
final PreMessageReceivedEventListener preMessageReceivedListener = new PreMessageReceivedEventListener() {
@Override
public Message onPreMessageReceived(Peer peer, Message m) {
if (m instanceof HeadersMessage) {
......@@ -196,7 +203,7 @@ public class BitcoindComparisonTool {
}
};
bitcoind.addConnectionEventListener(Threading.SAME_THREAD, listener);
bitcoind.addDataEventListener(Threading.SAME_THREAD, listener);
bitcoind.addPreMessageReceivedEventListener(Threading.SAME_THREAD, preMessageReceivedListener);
bitcoindChainHead = params.getGenesisBlock().getHash();
......
......@@ -47,7 +47,8 @@ public class PeerGroupTest extends TestWithPeerGroup {
private BlockingQueue<Peer> connectedPeers;
private BlockingQueue<Peer> disconnectedPeers;
private AbstractPeerEventListener listener;
private PeerConnectionEventListener listener;
private PreMessageReceivedEventListener preMessageReceivedListener;
private Map<Peer, AtomicInteger> peerToMessageCount;
@Parameterized.Parameters
......@@ -67,7 +68,7 @@ public class PeerGroupTest extends TestWithPeerGroup {
peerToMessageCount = new HashMap<Peer, AtomicInteger>();
connectedPeers = new LinkedBlockingQueue<Peer>();
disconnectedPeers = new LinkedBlockingQueue<Peer>();
listener = new AbstractPeerEventListener() {
listener = new PeerConnectionEventListener() {
@Override
public void onPeerConnected(Peer peer, int peerCount) {
connectedPeers.add(peer);
......@@ -78,6 +79,13 @@ public class PeerGroupTest extends TestWithPeerGroup {
disconnectedPeers.add(peer);
}
@Override
public void onPeersDiscovered(Set<PeerAddress> peerAddresses) {
// Ignore
}
};
preMessageReceivedListener = new PreMessageReceivedEventListener() {
@Override
public Message onPreMessageReceived(Peer peer, Message m) {
AtomicInteger messageCount = peerToMessageCount.get(peer);
......@@ -102,7 +110,7 @@ public class PeerGroupTest extends TestWithPeerGroup {
public void listener() throws Exception {
peerGroup.start();
peerGroup.addConnectionEventListener(listener);
peerGroup.addDataEventListener(listener);
peerGroup.addPreMessageReceivedEventListener(preMessageReceivedListener);
// Create a couple of peers.
InboundMessageQueuer p1 = connectPeer(1);
......@@ -124,8 +132,8 @@ public class PeerGroupTest extends TestWithPeerGroup {
assertTrue(peerGroup.removeConnectionEventListener(listener));
assertFalse(peerGroup.removeConnectionEventListener(listener));
assertTrue(peerGroup.removeDataEventListener(listener));
assertFalse(peerGroup.removeDataEventListener(listener));
assertTrue(peerGroup.removePreMessageReceivedEventListener(preMessageReceivedListener));
assertFalse(peerGroup.removePreMessageReceivedEventListener(preMessageReceivedListener));
}
@Test
......@@ -532,7 +540,7 @@ public class PeerGroupTest extends TestWithPeerGroup {
new InetSocketAddress("localhost", 2002)
);
peerGroup.addConnectionEventListener(listener);
peerGroup.addDataEventListener(listener);
peerGroup.addPreMessageReceivedEventListener(preMessageReceivedListener);
peerGroup.addPeerDiscovery(new PeerDiscovery() {
@Override
public InetSocketAddress[] getPeers(long services, long unused, TimeUnit unused2) throws PeerDiscoveryException {
......
......@@ -315,7 +315,7 @@ public class PeerTest extends TestWithNetworkConnections {
connect();
// Round-trip a ping so that we never see the response verack if we attach too quick
pingAndWait(writeTarget);
peer.addDataEventListener(Threading.SAME_THREAD, new AbstractPeerDataEventListener() {
peer.addPreMessageReceivedEventListener(Threading.SAME_THREAD, new PreMessageReceivedEventListener() {
@Override
public synchronized Message onPreMessageReceived(Peer p, Message m) {
if (p != peer)
......@@ -331,7 +331,8 @@ public class PeerTest extends TestWithNetworkConnections {
fail.set(true);
return m;
}
});
peer.addBlocksDownloadedEventListener(Threading.SAME_THREAD, new BlocksDownloadedEventListener() {
@Override
public synchronized void onBlocksDownloaded(Peer p, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft) {
int newValue = newBlockMessagesReceived.incrementAndGet();
......@@ -369,7 +370,7 @@ public class PeerTest extends TestWithNetworkConnections {
connect();
fail.set(true);
peer.addDataEventListener(Threading.SAME_THREAD, new AbstractPeerDataEventListener() {
peer.addChainDownloadStartedEventListener(Threading.SAME_THREAD, new ChainDownloadStartedEventListener() {
@Override
public void onChainDownloadStarted(Peer p, int blocksLeft) {
if (p == peer && blocksLeft == 108)
......
......@@ -18,8 +18,6 @@
package org.bitcoinj.testing;
import org.bitcoinj.core.listeners.AbstractPeerConnectionEventListener;
import org.bitcoinj.core.listeners.AbstractPeerDataEventListener;
import org.bitcoinj.core.listeners.PeerDataEventListener;
import org.bitcoinj.core.*;
import org.bitcoinj.net.*;
import org.bitcoinj.params.UnitTestParams;
......@@ -41,6 +39,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import org.bitcoinj.core.listeners.PreMessageReceivedEventListener;
/**
* Utility class that makes it easy to work with mock NetworkConnections.
......@@ -208,7 +207,7 @@ public class TestWithNetworkConnections {
private void inboundPongAndWait(final InboundMessageQueuer p, final long nonce) throws Exception {
// Receive a ping (that the Peer doesn't see) and wait for it to get through the socket
final SettableFuture<Void> pongReceivedFuture = SettableFuture.create();
PeerDataEventListener listener = new AbstractPeerDataEventListener() {
PreMessageReceivedEventListener listener = new PreMessageReceivedEventListener() {
@Override
public Message onPreMessageReceived(Peer p, Message m) {
if (m instanceof Pong && ((Pong) m).getNonce() == nonce) {
......@@ -218,10 +217,10 @@ public class TestWithNetworkConnections {
return m;
}
};
p.peer.addDataEventListener(Threading.SAME_THREAD, listener);
p.peer.addPreMessageReceivedEventListener(Threading.SAME_THREAD, listener);
inbound(p, new Pong(nonce));
pongReceivedFuture.get();
p.peer.removeDataEventListener(listener);
p.peer.removePreMessageReceivedEventListener(listener);
}
protected void pingAndWait(final InboundMessageQueuer p) throws Exception {
......
......@@ -14,7 +14,7 @@
package org.bitcoinj.examples;
import org.bitcoinj.core.listeners.AbstractPeerEventListener;
import org.bitcoinj.core.listeners.PreMessageReceivedEventListener;
import org.bitcoinj.core.*;
import org.bitcoinj.kits.WalletAppKit;
import org.bitcoinj.params.RegTestParams;
......@@ -46,8 +46,8 @@ public class DoubleSpend {
Transaction tx1 = kit.wallet().createSend(Address.fromBase58(params, "muYPFNCv7KQEG2ZLM7Z3y96kJnNyXJ53wm"), CENT);
Transaction tx2 = kit.wallet().createSend(Address.fromBase58(params, "muYPFNCv7KQEG2ZLM7Z3y96kJnNyXJ53wm"), CENT.add(SATOSHI.multiply(10)));
final Peer peer = kit.peerGroup().getConnectedPeers().get(0);
peer.addDataEventListener(Threading.SAME_THREAD,
new AbstractPeerEventListener() {
peer.addPreMessageReceivedEventListener(Threading.SAME_THREAD,
new PreMessageReceivedEventListener() {
@Override
public Message onPreMessageReceived(Peer peer, Message m) {
System.err.println("Got a message!" + m.getClass().getSimpleName() + ": " + m);
......
......@@ -48,8 +48,12 @@ import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import joptsimple.util.DateConverter;
import org.bitcoinj.core.listeners.AbstractPeerDataEventListener;
import org.bitcoinj.core.listeners.BlocksDownloadedEventListener;
import org.bitcoinj.core.listeners.DownloadProgressTracker;
import org.bitcoinj.core.listeners.WalletChangeEventListener;
import org.bitcoinj.core.listeners.WalletCoinsReceivedEventListener;
import org.bitcoinj.core.listeners.WalletCoinsSentEventListener;
import org.bitcoinj.core.listeners.WalletReorganizeEventListener;
import org.bitcoinj.wallet.MarriedKeyChain;
import org.bitcoinj.wallet.Protos;
import org.slf4j.Logger;
......@@ -77,10 +81,6 @@ import java.util.logging.LogManager;
import static org.bitcoinj.core.Coin.parseCoin;
import static com.google.common.base.Preconditions.checkNotNull;
import org.bitcoinj.core.listeners.WalletChangeEventListener;
import org.bitcoinj.core.listeners.WalletCoinsReceivedEventListener;
import org.bitcoinj.core.listeners.WalletCoinsSentEventListener;
import org.bitcoinj.core.listeners.WalletReorganizeEventListener;
/**
* A command line tool for manipulating wallets and working with Bitcoin.
......@@ -1131,7 +1131,7 @@ public class WalletTool {
break;
case BLOCK:
peers.addDataEventListener(new AbstractPeerDataEventListener() {
peers.addBlocksDownloadedEventListener(new BlocksDownloadedEventListener() {
@Override
public void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft) {
// Check if we already ran. This can happen if a block being received triggers download of more
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment