Skip to content

Commit 6e279c8

Browse files
authored
Update the VAA hash to use payload hash (#422)
* Update the VAA hash to use payload hash * Bugfix
1 parent b1aea62 commit 6e279c8

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

third_party/pyth/price-service/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

third_party/pyth/price-service/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/pyth-price-service",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "Pyth Price Service",
55
"main": "index.js",
66
"scripts": {

third_party/pyth/price-service/src/listen.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ export class Listener implements PriceStore {
160160
async processVaa(vaa: Buffer) {
161161
const { parse_vaa } = await importCoreWasm();
162162

163-
const vaaHash: VaaHash = createHash("md5").update(vaa).digest("base64");
163+
const parsedVaa = parse_vaa(vaa);
164+
165+
const vaaHash: VaaHash = createHash("md5")
166+
.update(Buffer.from(parsedVaa.payload))
167+
.digest("base64");
164168

165169
if (this.observedVaas.has(vaaHash)) {
166170
return;
@@ -169,8 +173,6 @@ export class Listener implements PriceStore {
169173
this.observedVaas.set(vaaHash, true);
170174
this.promClient?.incReceivedVaa();
171175

172-
const parsedVaa = parse_vaa(vaa);
173-
174176
let batchAttestation;
175177

176178
try {

0 commit comments

Comments
 (0)