Skip to content

Commit

Permalink
fix seq encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
acolytec3 committed Jan 13, 2025
1 parent 462ce73 commit 51eecab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/discv5/src/packet/encode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ export function decodeHeader(srcId: string, maskingIv: Uint8Array, data: Uint8Ar
// authdata

export function encodeWhoAreYouAuthdata(authdata: IWhoAreYouAuthdata): Uint8Array {
return concatBytes(authdata.idNonce, bigintToBytes(authdata.enrSeq));
// Pad sequence to 8 bytes
const seqBytes = new Uint8Array(8);
seqBytes.set(bigintToBytes(authdata.enrSeq), 0);
return concatBytes(authdata.idNonce, seqBytes);
}

export function encodeMessageAuthdata(authdata: IMessageAuthdata): Uint8Array {
Expand Down

0 comments on commit 51eecab

Please sign in to comment.