chore: improve var name

This commit is contained in:
fryorcraken.eth 2023-03-14 15:27:47 +11:00
parent 71985038a2
commit c781e49e1e
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 4 additions and 8 deletions

View File

@ -13,21 +13,17 @@ export function messageHash(
const pubsubTopicBytes = utf8ToBytes(pubsubTopic);
const contentTopicBytes = utf8ToBytes(message.contentTopic);
let bytesToHash;
let bytes;
if (message.meta) {
bytesToHash = concat([
bytes = concat([
pubsubTopicBytes,
message.payload,
contentTopicBytes,
message.meta,
]);
} else {
bytesToHash = concat([
pubsubTopicBytes,
message.payload,
contentTopicBytes,
]);
bytes = concat([pubsubTopicBytes, message.payload, contentTopicBytes]);
}
return sha256(bytesToHash);
return sha256(bytes);
}