mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Refactoring
This commit is contained in:
parent
badc872533
commit
c4932829fe
@ -156,7 +156,7 @@ public abstract class StateNetworkService<Msg extends NewStateHashMessage,
|
||||
|
||||
public void broadcastMyStateHash(StH myStateHash) {
|
||||
NewStateHashMessage newStateHashMessage = getNewStateHashMessage(myStateHash);
|
||||
broadcaster.broadcast(newStateHashMessage, networkNode.getNodeAddress(), null);
|
||||
broadcaster.broadcast(newStateHashMessage, networkNode.getNodeAddress());
|
||||
}
|
||||
|
||||
public void requestHashes(int fromHeight, String peersAddress) {
|
||||
|
@ -105,7 +105,7 @@ public class FullNodeNetworkService implements MessageListener, PeerManager.List
|
||||
log.info("Publish new block at height={} and block hash={}", block.getHeight(), block.getHash());
|
||||
RawBlock rawBlock = RawBlock.fromBlock(block);
|
||||
NewBlockBroadcastMessage newBlockBroadcastMessage = new NewBlockBroadcastMessage(rawBlock);
|
||||
broadcaster.broadcast(newBlockBroadcastMessage, networkNode.getNodeAddress(), null);
|
||||
broadcaster.broadcast(newBlockBroadcastMessage, networkNode.getNodeAddress());
|
||||
}
|
||||
|
||||
|
||||
|
@ -238,7 +238,7 @@ public class LiteNodeNetworkService implements MessageListener, ConnectionListen
|
||||
log.debug("We received a new message from peer {} and broadcast it to our peers. extBlockId={}",
|
||||
connection.getPeersNodeAddressOptional().orElse(null), extBlockId);
|
||||
receivedBlocks.add(extBlockId);
|
||||
broadcaster.broadcast(newBlockBroadcastMessage, connection.getPeersNodeAddressOptional().orElse(null), null);
|
||||
broadcaster.broadcast(newBlockBroadcastMessage, connection.getPeersNodeAddressOptional().orElse(null));
|
||||
listeners.forEach(listener -> listener.onNewBlockReceived(newBlockBroadcastMessage));
|
||||
} else {
|
||||
log.debug("We had that message already and do not further broadcast it. extBlockId={}", extBlockId);
|
||||
|
@ -54,6 +54,11 @@ public class Broadcaster implements BroadcastHandler.ResultHandler {
|
||||
// API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void broadcast(BroadcastMessage message,
|
||||
@Nullable NodeAddress sender) {
|
||||
broadcast(message, sender, null);
|
||||
}
|
||||
|
||||
public void broadcast(BroadcastMessage message,
|
||||
@Nullable NodeAddress sender,
|
||||
@Nullable BroadcastHandler.Listener listener) {
|
||||
|
@ -529,7 +529,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers
|
||||
|
||||
// Broadcast the payload if requested by caller
|
||||
if (allowBroadcast)
|
||||
broadcaster.broadcast(new AddPersistableNetworkPayloadMessage(payload), sender, null);
|
||||
broadcaster.broadcast(new AddPersistableNetworkPayloadMessage(payload), sender);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -675,7 +675,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers
|
||||
sequenceNumberMapStorage.queueUpForSave(SequenceNumberMap.clone(sequenceNumberMap), 1000);
|
||||
|
||||
// Always broadcast refreshes
|
||||
broadcaster.broadcast(refreshTTLMessage, sender, null);
|
||||
broadcaster.broadcast(refreshTTLMessage, sender);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -725,9 +725,9 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers
|
||||
printData("after remove");
|
||||
|
||||
if (protectedStorageEntry instanceof ProtectedMailboxStorageEntry) {
|
||||
broadcaster.broadcast(new RemoveMailboxDataMessage((ProtectedMailboxStorageEntry) protectedStorageEntry), sender, null);
|
||||
broadcaster.broadcast(new RemoveMailboxDataMessage((ProtectedMailboxStorageEntry) protectedStorageEntry), sender);
|
||||
} else {
|
||||
broadcaster.broadcast(new RemoveDataMessage(protectedStorageEntry), sender, null);
|
||||
broadcaster.broadcast(new RemoveDataMessage(protectedStorageEntry), sender);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user