forked from Qortal/qortal
Don't propagate new transactions back to sending peer. Added small inter-peer delay when doing network broadcast.
This commit is contained in:
parent
c2e8392f05
commit
1d7bda5d46
@ -744,7 +744,7 @@ public class Controller extends Thread {
|
||||
break;
|
||||
|
||||
// Broadcast signatures that are new to us
|
||||
Network.getInstance().broadcast(broadcastPeer -> new TransactionSignaturesMessage(newSignatures));
|
||||
Network.getInstance().broadcast(broadcastPeer -> broadcastPeer == peer ? null : new TransactionSignaturesMessage(newSignatures));
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
@ -781,7 +782,16 @@ public class Network extends Thread {
|
||||
public void run() {
|
||||
Thread.currentThread().setName("Network Broadcast");
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
for (Peer peer : targetPeers) {
|
||||
// Very short sleep to reduce strain, improve multithreading and catch interrupts
|
||||
try {
|
||||
Thread.sleep(random.nextInt(20) + 20);
|
||||
} catch (InterruptedException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
Message message = peerMessageBuilder.apply(peer);
|
||||
|
||||
if (message == null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user