@Test public void testBloomOnP2Pubkey() throws Exception { peerGroup.startAndWait(); final ECKey key = wallet.getKeys().get(0); InboundMessageQueuer p1 = connectPeer(1); InboundMessageQueuer p2 = connectPeer(2); Transaction tx = TestUtils.createFakeTx(params, Utils.COIN, key); Transaction tx2 = new Transaction(params); tx2.addInput(tx.getOutput(0)); TransactionOutPoint outpoint = tx2.getInput(0).getOutpoint(); assertTrue(p1.lastReceivedFilter.contains(key.getPubKey())); assertFalse(p1.lastReceivedFilter.contains(tx.getHash().getBytes())); inbound(p1, tx); assertTrue(outbound(p1) instanceof GetDataMessage); final Sha256Hash dephash = tx.getInput(0).getOutpoint().getHash(); final InventoryItem inv = new InventoryItem(InventoryItem.Type.Transaction, dephash); inbound(p1, new NotFoundMessage(params, ImmutableList.of(inv))); assertNull(outbound(p1)); assertNull(outbound(p2)); peerGroup.waitForJobQueue(); InboundMessageQueuer p3 = connectPeer(3); assertTrue(p3.lastReceivedFilter.contains(key.getPubKey())); assertTrue(p3.lastReceivedFilter.contains(outpoint.bitcoinSerialize())); }
@VisibleForTesting void waitForJobQueue() { final CountDownLatch latch = new CountDownLatch(1); Uninterruptibles.putUninterruptibly(jobQueue, new Runnable() { @Override public void run() { latch.countDown(); } }); Uninterruptibles.awaitUninterruptibly(latch); }
PeerGroup extends AbstractExecutionThreadService implements TransactionBroadcaster { @VisibleForTesting void waitForJobQueue() { final CountDownLatch latch = new CountDownLatch(1); Uninterruptibles.putUninterruptibly(jobQueue, new Runnable() { @Override public void run() { latch.countDown(); } }); Uninterruptibles.awaitUninterruptibly(latch); } }
PeerGroup extends AbstractExecutionThreadService implements TransactionBroadcaster { @VisibleForTesting void waitForJobQueue() { final CountDownLatch latch = new CountDownLatch(1); Uninterruptibles.putUninterruptibly(jobQueue, new Runnable() { @Override public void run() { latch.countDown(); } }); Uninterruptibles.awaitUninterruptibly(latch); } PeerGroup(NetworkParameters params);  PeerGroup(NetworkParameters params, @Nullable AbstractBlockChain chain);  PeerGroup(NetworkParameters params, @Nullable AbstractBlockChain chain, ClientConnectionManager connectionManager); }
PeerGroup extends AbstractExecutionThreadService implements TransactionBroadcaster { @VisibleForTesting void waitForJobQueue() { final CountDownLatch latch = new CountDownLatch(1); Uninterruptibles.putUninterruptibly(jobQueue, new Runnable() { @Override public void run() { latch.countDown(); } }); Uninterruptibles.awaitUninterruptibly(latch); } PeerGroup(NetworkParameters params);  PeerGroup(NetworkParameters params, @Nullable AbstractBlockChain chain);  PeerGroup(NetworkParameters params, @Nullable AbstractBlockChain chain, ClientConnectionManager connectionManager); void setMaxConnections(int maxConnections); int getMaxConnections(); void setVersionMessage(VersionMessage ver); VersionMessage getVersionMessage(); void setUserAgent(String name, String version, @Nullable String comments); void setUserAgent(String name, String version); void addEventListener(PeerEventListener listener, Executor executor); void addEventListener(PeerEventListener listener); boolean removeEventListener(PeerEventListener listener); void clearEventListeners(); List<Peer> getConnectedPeers(); List<Peer> getPendingPeers(); void addAddress(PeerAddress peerAddress); void addAddress(InetAddress address); void addPeerDiscovery(PeerDiscovery peerDiscovery); void addWallet(Wallet wallet); void addPeerFilterProvider(PeerFilterProvider provider); void removeWallet(Wallet wallet); void recalculateFastCatchupAndFilter(FilterRecalculateMode mode); void setBloomFilterFalsePositiveRate(double bloomFilterFPRate); int numConnectedPeers(); @Nullable Peer connectTo(InetSocketAddress address); void setConnectTimeoutMillis(int connectTimeoutMillis); void startBlockChainDownload(PeerEventListener listener); void downloadBlockChain(); MemoryPool getMemoryPool(); void setFastCatchupTimeSecs(long secondsSinceEpoch); long getFastCatchupTimeSecs(); ListenableFuture<PeerGroup> waitForPeers(final int numPeers); int getMinBroadcastConnections(); void setMinBroadcastConnections(int value); ListenableFuture<Transaction> broadcastTransaction(final Transaction tx); ListenableFuture<Transaction> broadcastTransaction(final Transaction tx, final int minConnections); long getPingIntervalMsec(); void setPingIntervalMsec(long pingIntervalMsec); void setMinRequiredProtocolVersion(int minRequiredProtocolVersion); int getMinRequiredProtocolVersion(); int getMostCommonChainHeight(); static int getMostCommonChainHeight(final List<Peer> peers); Peer getDownloadPeer(); }
PeerGroup extends AbstractExecutionThreadService implements TransactionBroadcaster { @VisibleForTesting void waitForJobQueue() { final CountDownLatch latch = new CountDownLatch(1); Uninterruptibles.putUninterruptibly(jobQueue, new Runnable() { @Override public void run() { latch.countDown(); } }); Uninterruptibles.awaitUninterruptibly(latch); } PeerGroup(NetworkParameters params);  PeerGroup(NetworkParameters params, @Nullable AbstractBlockChain chain);  PeerGroup(NetworkParameters params, @Nullable AbstractBlockChain chain, ClientConnectionManager connectionManager); void setMaxConnections(int maxConnections); int getMaxConnections(); void setVersionMessage(VersionMessage ver); VersionMessage getVersionMessage(); void setUserAgent(String name, String version, @Nullable String comments); void setUserAgent(String name, String version); void addEventListener(PeerEventListener listener, Executor executor); void addEventListener(PeerEventListener listener); boolean removeEventListener(PeerEventListener listener); void clearEventListeners(); List<Peer> getConnectedPeers(); List<Peer> getPendingPeers(); void addAddress(PeerAddress peerAddress); void addAddress(InetAddress address); void addPeerDiscovery(PeerDiscovery peerDiscovery); void addWallet(Wallet wallet); void addPeerFilterProvider(PeerFilterProvider provider); void removeWallet(Wallet wallet); void recalculateFastCatchupAndFilter(FilterRecalculateMode mode); void setBloomFilterFalsePositiveRate(double bloomFilterFPRate); int numConnectedPeers(); @Nullable Peer connectTo(InetSocketAddress address); void setConnectTimeoutMillis(int connectTimeoutMillis); void startBlockChainDownload(PeerEventListener listener); void downloadBlockChain(); MemoryPool getMemoryPool(); void setFastCatchupTimeSecs(long secondsSinceEpoch); long getFastCatchupTimeSecs(); ListenableFuture<PeerGroup> waitForPeers(final int numPeers); int getMinBroadcastConnections(); void setMinBroadcastConnections(int value); ListenableFuture<Transaction> broadcastTransaction(final Transaction tx); ListenableFuture<Transaction> broadcastTransaction(final Transaction tx, final int minConnections); long getPingIntervalMsec(); void setPingIntervalMsec(long pingIntervalMsec); void setMinRequiredProtocolVersion(int minRequiredProtocolVersion); int getMinRequiredProtocolVersion(); int getMostCommonChainHeight(); static int getMostCommonChainHeight(final List<Peer> peers); Peer getDownloadPeer(); static final long DEFAULT_PING_INTERVAL_MSEC; static final double DEFAULT_BLOOM_FILTER_FP_RATE; static final double MAX_FP_RATE_INCREASE; static final int DEFAULT_CONNECT_TIMEOUT_MILLIS; }