From 1f07b3ac4fdd78558c3c78cae8c1791e66bbb456 Mon Sep 17 00:00:00 2001 From: Alexis Batyk Date: Tue, 13 Aug 2024 10:22:56 -0300 Subject: [PATCH] fixed: always showing put changes as putrequest --- network-monitor/src/app.ts | 25 ++++++++++++++---------- network-monitor/src/transactions-data.ts | 1 + 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/network-monitor/src/app.ts b/network-monitor/src/app.ts index ad1cff232..b99755957 100644 --- a/network-monitor/src/app.ts +++ b/network-monitor/src/app.ts @@ -2,7 +2,8 @@ import * as flatbuffers from "flatbuffers"; import * as fbTopology from "./generated/topology"; import { handleChange } from "./topology"; import { handlePutRequest, handlePutSuccess } from "./transactions-data"; -import { parse_put_msg_data } from "./utils"; +import { get_change_type, parse_put_msg_data } from "./utils"; +import { ChangeType } from "./type_definitions"; let connection_established = false; @@ -44,6 +45,16 @@ function handleChanges(event: MessageEvent) { const contractChange = fbTopology.ContractChange.getRootAsContractChange(buf); + console.log( + "raw contract change changeType", + contractChange.changeType() + ); + + console.log( + "parsed contract change changeType", + get_change_type(contractChange.changeType()) + ); + let { transaction, contract_id, @@ -54,13 +65,10 @@ function handleChanges(event: MessageEvent) { contract_location, } = parse_put_msg_data( contractChange, - fbTopology.ContractChangeType.PutRequest + contractChange.changeType() ); - if ( - contractChange.changeType() === - fbTopology.ContractChangeType.PutRequest - ) { + if (change_type == ChangeType.PUT_REQUEST) { handlePutRequest( transaction, contract_id, @@ -74,10 +82,7 @@ function handleChanges(event: MessageEvent) { return; } - if ( - contractChange.changeType() === - fbTopology.ContractChangeType.PutSuccess - ) { + if (change_type == ChangeType.PUT_SUCCESS) { handlePutSuccess( transaction, contract_id, diff --git a/network-monitor/src/transactions-data.ts b/network-monitor/src/transactions-data.ts index 4bc841a4a..10e29685c 100644 --- a/network-monitor/src/transactions-data.ts +++ b/network-monitor/src/transactions-data.ts @@ -70,6 +70,7 @@ export function handlePutSuccess( console.log("Put Success"); console.log("tx", transaction_id); console.log("contract key", contract_id); + console.log("change_type", change_type); console.log("target", target); console.log("requester", requester); console.log("timestamp", timestamp);