Skip to content

Commit bb047b6

Browse files
committed
identity signer node length
1 parent 74ff7da commit bb047b6

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/wallet/primitives/src/session-config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,12 +415,13 @@ function decodeSessionTopologyPointer(bytes: Bytes.Bytes): {
415415
return { topology: { type: 'implicit-blacklist', blacklist }, pointer: offset + blacklistLength * 20 }
416416
} else if (flag === SESSIONS_FLAG_IDENTITY_SIGNER) {
417417
// Identity signer
418-
if (bytes.length < 21) {
418+
const nodeLength = 21 // Flag + address
419+
if (bytes.length < nodeLength) {
419420
throw new Error('Invalid identity signer length')
420421
}
421422
return {
422-
topology: { type: 'identity-signer', identitySigner: Address.from(Hex.fromBytes(bytes.slice(1, 21))) },
423-
pointer: 21,
423+
topology: { type: 'identity-signer', identitySigner: Address.from(Hex.fromBytes(bytes.slice(1, nodeLength))) },
424+
pointer: nodeLength,
424425
}
425426
} else {
426427
throw new Error(`Invalid topology flag: ${flag}`)

0 commit comments

Comments
 (0)