3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-11 17:55:53 +00:00

TransactionBroadcast: Member variable to local

This commit is contained in:
Mike Hearn 2014-12-07 13:18:01 +02:00
parent 40c4338aaa
commit 0a34914d16

View File

@ -44,7 +44,7 @@ public class TransactionBroadcast {
private final Transaction tx;
@Nullable private final Context context;
private int minConnections;
private int numWaitingFor, numToBroadcastTo;
private int numWaitingFor;
/** Used for shuffling the peers before broadcast: unit tests can replace this to make themselves deterministic. */
@VisibleForTesting
@ -117,7 +117,7 @@ public class TransactionBroadcast {
// our version message, as SPV nodes cannot relay it doesn't give away any additional information
// to skip the inv here - we wouldn't send invs anyway.
int numConnected = peers.size();
numToBroadcastTo = (int) Math.max(1, Math.round(Math.ceil(peers.size() / 2.0)));
int numToBroadcastTo = (int) Math.max(1, Math.round(Math.ceil(peers.size() / 2.0)));
numWaitingFor = (int) Math.ceil((peers.size() - numToBroadcastTo) / 2.0);
Collections.shuffle(peers, random);
peers = peers.subList(0, numToBroadcastTo);