mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-16 04:05:50 +00:00
TransactionBroadcast: when there are an odd number of peers, bias towards more receivers rather than more announcers.
This commit is contained in:
parent
2bca8e858b
commit
62078f55c0
@ -97,7 +97,7 @@ public class TransactionBroadcast {
|
|||||||
// our version message, as SPV nodes cannot relay it doesn't give away any additional information
|
// 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.
|
// to skip the inv here - we wouldn't send invs anyway.
|
||||||
int numConnected = peers.size();
|
int numConnected = peers.size();
|
||||||
numToBroadcastTo = Math.max(1, peers.size() / 2);
|
numToBroadcastTo = (int) Math.max(1, Math.round(Math.ceil(peers.size() / 2.0)));
|
||||||
numWaitingFor = (int) Math.ceil((peers.size() - numToBroadcastTo) / 2.0);
|
numWaitingFor = (int) Math.ceil((peers.size() - numToBroadcastTo) / 2.0);
|
||||||
Collections.shuffle(peers, random);
|
Collections.shuffle(peers, random);
|
||||||
peers = peers.subList(0, numToBroadcastTo);
|
peers = peers.subList(0, numToBroadcastTo);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user