mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Set uid inside constructor
This commit is contained in:
parent
873b557ce8
commit
7a2501ea1b
4 changed files with 11 additions and 13 deletions
|
@ -68,7 +68,6 @@ import javafx.beans.property.SimpleIntegerProperty;
|
|||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -427,8 +426,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
|||
// send it if peer has not updated.
|
||||
PrefixedSealedAndSignedMessage sealedMsg = new PrefixedSealedAndSignedMessage(
|
||||
networkNode.getNodeAddress(),
|
||||
encryptionService.encryptAndSign(pubKeyRing, message),
|
||||
UUID.randomUUID().toString());
|
||||
encryptionService.encryptAndSign(pubKeyRing, message));
|
||||
|
||||
SettableFuture<Connection> future = networkNode.sendMessage(peersNodeAddress, sealedMsg);
|
||||
Futures.addCallback(future, new FutureCallback<>() {
|
||||
|
|
|
@ -25,6 +25,8 @@ import bisq.common.proto.network.NetworkEnvelope;
|
|||
|
||||
import com.google.protobuf.ByteString;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
|
||||
|
@ -43,9 +45,12 @@ public final class PrefixedSealedAndSignedMessage extends NetworkEnvelope implem
|
|||
private final String uid;
|
||||
|
||||
public PrefixedSealedAndSignedMessage(NodeAddress senderNodeAddress,
|
||||
SealedAndSigned sealedAndSigned,
|
||||
String uid) {
|
||||
this(senderNodeAddress, sealedAndSigned, new byte[0], uid, Version.getP2PMessageVersion());
|
||||
SealedAndSigned sealedAndSigned) {
|
||||
this(senderNodeAddress,
|
||||
sealedAndSigned,
|
||||
new byte[0],
|
||||
UUID.randomUUID().toString(),
|
||||
Version.getP2PMessageVersion());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -203,8 +202,7 @@ public class MailboxMessageService implements SetupListener, RequestDataManager.
|
|||
try {
|
||||
PrefixedSealedAndSignedMessage prefixedSealedAndSignedMessage = new PrefixedSealedAndSignedMessage(
|
||||
networkNode.getNodeAddress(),
|
||||
encryptionService.encryptAndSign(peersPubKeyRing, message),
|
||||
UUID.randomUUID().toString());
|
||||
encryptionService.encryptAndSign(peersPubKeyRing, message));
|
||||
SettableFuture<Connection> future = networkNode.sendMessage(peer, prefixedSealedAndSignedMessage);
|
||||
Futures.addCallback(future, new FutureCallback<>() {
|
||||
@Override
|
||||
|
|
|
@ -41,8 +41,6 @@ import java.time.Clock;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.junit.Before;
|
||||
|
@ -69,8 +67,7 @@ public class AddDataMessageTest {
|
|||
@Test
|
||||
public void toProtoBuf() throws Exception {
|
||||
SealedAndSigned sealedAndSigned = new SealedAndSigned(RandomUtils.nextBytes(10), RandomUtils.nextBytes(10), RandomUtils.nextBytes(10), keyRing1.getPubKeyRing().getSignaturePubKey());
|
||||
PrefixedSealedAndSignedMessage prefixedSealedAndSignedMessage = new PrefixedSealedAndSignedMessage(new NodeAddress("host", 1000), sealedAndSigned,
|
||||
UUID.randomUUID().toString());
|
||||
PrefixedSealedAndSignedMessage prefixedSealedAndSignedMessage = new PrefixedSealedAndSignedMessage(new NodeAddress("host", 1000), sealedAndSigned);
|
||||
MailboxStoragePayload mailboxStoragePayload = new MailboxStoragePayload(prefixedSealedAndSignedMessage,
|
||||
keyRing1.getPubKeyRing().getSignaturePubKey(), keyRing1.getPubKeyRing().getSignaturePubKey());
|
||||
ProtectedStorageEntry protectedStorageEntry = new ProtectedMailboxStorageEntry(mailboxStoragePayload,
|
||||
|
|
Loading…
Add table
Reference in a new issue