Skip to content

Commit

Permalink
Remove unnecessary white spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarguindzberg committed Dec 20, 2018
1 parent b2e11ec commit da9faae
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 30 deletions.
33 changes: 17 additions & 16 deletions core/src/main/java/org/bitcoinj/core/PeerGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@
/**
* <p>Runs a set of connections to the P2P network, brings up connections to replace disconnected nodes and manages
* the interaction between them all. Most applications will want to use one of these.</p>
*
*
* <p>PeerGroup tries to maintain a constant number of connections to a set of distinct peers.
* Each peer runs a network listener in its own thread. When a connection is lost, a new peer
* will be tried after a delay as long as the number of connections less than the maximum.</p>
*
*
* <p>Connections are made to addresses from a provided list. When that list is exhausted,
* we start again from the head of the list.</p>
*
*
* <p>The PeerGroup can broadcast a transaction to the currently connected set of peers. It can
* also handle download of the blockchain from peers, restarting the process when peers die.</p>
*
* <p>A PeerGroup won't do anything until you call the {@link PeerGroup#start()} method
* which will block until peer discovery is completed and some outbound connections
* have been initiated (it will return before handshaking is done, however).
* <p>A PeerGroup won't do anything until you call the {@link PeerGroup#start()} method
* which will block until peer discovery is completed and some outbound connections
* have been initiated (it will return before handshaking is done, however).
* You should call {@link PeerGroup#stop()} when finished. Note that not all methods
* of PeerGroup are safe to call from a UI thread as some may do network IO,
* of PeerGroup are safe to call from a UI thread as some may do network IO,
* but starting and stopping the service should be fine.</p>
*/
public class PeerGroup implements TransactionBroadcaster {
Expand Down Expand Up @@ -283,7 +283,7 @@ public void onPeerDisconnected(Peer peer, int peerCount) {
/** The default timeout between when a connection attempt begins and version message exchange completes */
public static final int DEFAULT_CONNECT_TIMEOUT_MILLIS = 5000;
private volatile int vConnectTimeoutMillis = DEFAULT_CONNECT_TIMEOUT_MILLIS;

/** Whether bloom filter support is enabled when using a non FullPrunedBlockchain*/
private volatile boolean vBloomFilteringEnabled = true;

Expand Down Expand Up @@ -668,7 +668,7 @@ public VersionMessage getVersionMessage() {
}

/**
* Sets information that identifies this software to remote nodes. This is a convenience wrapper for creating
* Sets information that identifies this software to remote nodes. This is a convenience wrapper for creating
* a new {@link VersionMessage}, calling {@link VersionMessage#appendToSubVer(String, String, String)} on it,
* and then calling {@link PeerGroup#setVersionMessage(VersionMessage)} on the result of that. See the docs for
* {@link VersionMessage#appendToSubVer(String, String, String)} for information on what the fields should contain.
Expand All @@ -682,7 +682,7 @@ public void setUserAgent(String name, String version, @Nullable String comments)
ver.appendToSubVer(name, version, comments);
setVersionMessage(ver);
}

// Updates the relayTxesBeforeFilter flag of ver
private void updateVersionMessageRelayTxesBeforeFilter(VersionMessage ver) {
// We will provide the remote node with a bloom filter (ie they shouldn't relay yet)
Expand Down Expand Up @@ -1319,7 +1319,7 @@ public void removeWallet(Wallet wallet) {
wallet.setTransactionBroadcaster(null);
for (Peer peer : peers) {
peer.removeWallet(wallet);
}
}
}

public enum FilterRecalculateMode {
Expand Down Expand Up @@ -1403,13 +1403,13 @@ public void go() {
}
return future;
}

/**
* <p>Sets the false positive rate of bloom filters given to peers. The default is {@link #DEFAULT_BLOOM_FILTER_FP_RATE}.</p>
*
* <p>Be careful regenerating the bloom filter too often, as it decreases anonymity because remote nodes can
* compare transactions against both the new and old filters to significantly decrease the false positive rate.</p>
*
*
* <p>See the docs for {@link BloomFilter#BloomFilter(int, double, long, BloomFilter.BloomUpdate)} for a brief
* explanation of anonymity when using bloom filters.</p>
*/
Expand All @@ -1424,7 +1424,7 @@ public void setBloomFilterFalsePositiveRate(double bloomFilterFPRate) {
}

/**
* Returns the number of currently connected peers. To be informed when this count changes, register a
* Returns the number of currently connected peers. To be informed when this count changes, register a
* {@link org.bitcoinj.core.listeners.PeerConnectionEventListener} and use the onPeerConnected/onPeerDisconnected methods.
*/
public int numConnectedPeers() {
Expand All @@ -1434,7 +1434,7 @@ public int numConnectedPeers() {
/**
* Connect to a peer by creating a channel to the destination address. This should not be
* used normally - let the PeerGroup manage connections through {@link #start()}
*
*
* @param address destination IP and port.
* @return The newly created Peer object or null if the peer could not be connected.
* Use {@link org.bitcoinj.core.Peer#getConnectionOpenFuture()} if you
Expand Down Expand Up @@ -1582,7 +1582,7 @@ private static void removeDataEventListenerFromPeer(Peer peer, PeerDataEventList

/**
* Download the blockchain from peers. Convenience that uses a {@link DownloadProgressTracker} for you.<p>
*
*
* This method waits until the download is complete. "Complete" is defined as downloading
* from at least one peer all the blocks that are in that peer's inventory.
*/
Expand Down Expand Up @@ -2166,6 +2166,7 @@ public TransactionBroadcast broadcastTransaction(final Transaction tx, final int
}
final TransactionBroadcast broadcast = new TransactionBroadcast(this, tx);
broadcast.setMinConnections(minConnections);

// Send the TX to the wallet once we have a successful broadcast.
Futures.addCallback(broadcast.future(), new FutureCallback<Transaction>() {
@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/bitcoinj/core/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
* Whether to trust a transaction is something that needs to be decided on a case by case basis - a rule that makes
* sense for selling MP3s might not make sense for selling cars, or accepting payments from a family member. If you
* are building a wallet, how to present confidence to your users is something to consider carefully.</p>
*
*
* <p>Instances of this class are not safe for use by multiple threads.</p>
*/
public class Transaction extends ChildMessage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class TransactionBroadcast {
/** Used for shuffling the peers before broadcast: unit tests can replace this to make themselves deterministic. */
@VisibleForTesting
public static Random random = new Random();

// Tracks which nodes sent us a reject message about this broadcast, if any. Useful for debugging.
private Map<Peer, RejectMessage> rejects = Collections.synchronizedMap(new HashMap<Peer, RejectMessage>());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ public enum ConfidenceType {
* If a transaction hasn't been broadcast yet, or there's no record of it, its confidence is UNKNOWN.
*/
UNKNOWN(0);

private int value;
ConfidenceType(int value) {
this.value = value;
}

public int getValue() {
return value;
}
Expand Down Expand Up @@ -262,7 +262,7 @@ public synchronized ConfidenceType getConfidenceType() {
}

/**
* Called by other objects in the system, like a {@link Wallet}, when new information about the confidence of a
* Called by other objects in the system, like a {@link Wallet}, when new information about the confidence of a
* transaction becomes available.
*/
public synchronized void setConfidenceType(ConfidenceType confidenceType) {
Expand Down Expand Up @@ -378,7 +378,7 @@ public synchronized int incrementDepthInBlocks() {
* considers a transaction impractical to reverse after 6 blocks, but as of EOY 2011 network
* security is high enough that often only one block is considered enough even for high value transactions. For low
* value transactions like songs, or other cheap items, no blocks at all may be necessary.</p>
*
*
* <p>If the transaction appears in the top block, the depth is one. If it's anything else (pending, dead, unknown)
* the depth is zero.</p>
*/
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/org/bitcoinj/core/VersionMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@

/**
* <p>A VersionMessage holds information exchanged during connection setup with another peer. Most of the fields are not
* particularly interesting. The subVer field, since BIP 14, acts as a User-Agent string would. You can and should
* particularly interesting. The subVer field, since BIP 14, acts as a User-Agent string would. You can and should
* append to or change the subVer for your own software so other implementations can identify it, and you can look at
* the subVer field received from other nodes to see what they are running.</p>
*
* <p>After creating yourself a VersionMessage, you can pass it to {@link PeerGroup#setVersionMessage(VersionMessage)}
* to ensure it will be used for each new connection.</p>
*
*
* <p>Instances of this class are not safe for use by multiple threads.</p>
*/
public class VersionMessage extends Message {
Expand Down Expand Up @@ -91,7 +91,7 @@ public VersionMessage(NetworkParameters params, byte[] payload) throws ProtocolE
// It doesn't really make sense to ever lazily parse a version message or to retain the backing bytes.
// If you're receiving this on the wire you need to check the protocol version and it will never need to be sent
// back down the wire.

public VersionMessage(NetworkParameters params, int newBestHeight) {
super(params);
clientVersion = params.getProtocolVersionNum(NetworkParameters.ProtocolVersion.CURRENT);
Expand Down Expand Up @@ -170,7 +170,7 @@ public void bitcoinSerializeToStream(OutputStream buf) throws IOException {
throw new RuntimeException(e); // Can't happen.
}
// Next up is the "local host nonce", this is to detect the case of connecting
// back to yourself. We don't care about this as we won't be accepting inbound
// back to yourself. We don't care about this as we won't be accepting inbound
// connections.
Utils.uint32ToByteStreamLE(0, buf);
Utils.uint32ToByteStreamLE(0, buf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public AbstractBitcoinNetParams() {

/**
* Checks if we are at a difficulty transition point.
*
* @param storedPrev The previous stored block
* @return If this is a difficulty transition point
*/
Expand All @@ -63,7 +64,7 @@ protected boolean isDifficultyTransitionPoint(StoredBlock storedPrev) {

@Override
public void checkDifficultyTransitions(final StoredBlock storedPrev, final Block nextBlock,
final BlockStore blockStore) throws VerificationException, BlockStoreException {
final BlockStore blockStore) throws VerificationException, BlockStoreException {
Block prev = storedPrev.getHeader();

// Is this supposed to be a difficulty transition point?
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/org/bitcoinj/wallet/Wallet.java
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ public DeterministicKey getWatchingKey() {
/**
* Returns whether this wallet consists entirely of watching keys (unencrypted keys with no private part). Mixed
* wallets are forbidden.
*
*
* @throws IllegalStateException
* if there are no keys, or if there is a mix between watching and non-watching keys.
*/
Expand Down Expand Up @@ -4637,10 +4637,10 @@ public BloomFilter getBloomFilter(double falsePositiveRate) {
* <p>Gets a bloom filter that contains all of the public keys from this wallet, and which will provide the given
* false-positive rate if it has size elements. Keep in mind that you will get 2 elements in the bloom filter for
* each key in the wallet, for the public key and the hash of the public key (address form).</p>
*
*
* <p>This is used to generate a BloomFilter which can be {@link BloomFilter#merge(BloomFilter)}d with another.
* It could also be used if you have a specific target for the filter's size.</p>
*
*
* <p>See the docs for {@link BloomFilter(int, double)} for a brief explanation of anonymity when using bloom
* filters.</p>
*/
Expand Down

0 comments on commit da9faae

Please sign in to comment.