Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ public WhoAreYouPacket(BytesValue bytes) {
super(bytes);
}

public static WhoAreYouPacket create(
/**
* Create a packet by converting {@code destNodeId} to a magic value
*/
public static WhoAreYouPacket createFromNodeId(
Bytes32 destNodeId, BytesValue authTag, Bytes32 idNonce, UInt64 enrSeq) {
BytesValue magic = getStartMagic(destNodeId);
return create(magic, authTag, idNonce, enrSeq);
return createFromMagic(magic, authTag, idNonce, enrSeq);
}

public static WhoAreYouPacket create(
public static WhoAreYouPacket createFromMagic(
BytesValue magic, BytesValue authTag, Bytes32 idNonce, UInt64 enrSeq) {
byte[] rlpListEncoded =
RlpEncoder.encode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void handle(Envelope envelope) {
Bytes32 idNonce = Bytes32.wrap(idNonceBytes);
session.setIdNonce(idNonce);
WhoAreYouPacket whoAreYouPacket =
WhoAreYouPacket.create(
WhoAreYouPacket.createFromNodeId(
session.getNodeRecord().getNodeId(),
authTag,
idNonce,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void authHandlerWithMessageRoundTripTest() throws Exception {
authTagRepository1.put(authTag, nodeSessionAt1For2);
envelopeAt1From2.put(
Field.PACKET_WHOAREYOU,
WhoAreYouPacket.create(nodePair1.getValue1().getNodeId(), authTag, idNonce, UInt64.ZERO));
WhoAreYouPacket.createFromNodeId(nodePair1.getValue1().getNodeId(), authTag, idNonce, UInt64.ZERO));
envelopeAt1From2.put(Field.SESSION, nodeSessionAt1For2);
CompletableFuture<Void> future = new CompletableFuture<>();
nodeSessionAt1For2.createNextRequest(TaskType.FINDNODE, new TaskOptions(true), future);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void encodeRandomPacketTest() {
@Test
public void encodeWhoAreYouTest() {
WhoAreYouPacket whoAreYouPacket =
WhoAreYouPacket.create(
WhoAreYouPacket.createFromMagic(
BytesValue.fromHexString(
"0x0101010101010101010101010101010101010101010101010101010101010101"),
BytesValue.fromHexString("0x020202020202020202020202"),
Expand Down