Update the VAA hash to use payload hash (#422)

* Update the VAA hash to use payload hash

* Bugfix
This commit is contained in:
Ali Behjati 2022-12-09 14:53:01 +01:00 committed by GitHub
parent b1aea626e9
commit 6e279c84bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -1,12 +1,12 @@
{
"name": "@pythnetwork/pyth-price-service",
"version": "2.2.0",
"version": "2.2.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@pythnetwork/pyth-price-service",
"version": "2.2.0",
"version": "2.2.1",
"license": "Apache-2.0",
"dependencies": {
"@certusone/wormhole-sdk": "^0.1.4",

View File

@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-price-service",
"version": "2.2.0",
"version": "2.2.1",
"description": "Pyth Price Service",
"main": "index.js",
"scripts": {

View File

@ -160,7 +160,11 @@ export class Listener implements PriceStore {
async processVaa(vaa: Buffer) {
const { parse_vaa } = await importCoreWasm();
const vaaHash: VaaHash = createHash("md5").update(vaa).digest("base64");
const parsedVaa = parse_vaa(vaa);
const vaaHash: VaaHash = createHash("md5")
.update(Buffer.from(parsedVaa.payload))
.digest("base64");
if (this.observedVaas.has(vaaHash)) {
return;
@ -169,8 +173,6 @@ export class Listener implements PriceStore {
this.observedVaas.set(vaaHash, true);
this.promClient?.incReceivedVaa();
const parsedVaa = parse_vaa(vaa);
let batchAttestation;
try {