Skip to content

Commit

Permalink
fixed: always showing put changes as putrequest
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisbatyk committed Aug 13, 2024
1 parent 4495434 commit 1f07b3a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
25 changes: 15 additions & 10 deletions network-monitor/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions network-monitor/src/transactions-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1f07b3a

Please sign in to comment.