Skip to content

Commit

Permalink
Move saveOnlyGossipData and stopGossipTxData flags to the config
Browse files Browse the repository at this point in the history
  • Loading branch information
jairajdev committed Jun 24, 2024
1 parent c241ead commit b80f544
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
6 changes: 6 additions & 0 deletions src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ export interface Config {
randomGossipArchiversCount: 2 // Number of random archivers to gossip to
subscribeToMoreConsensors: boolean // To subscribe to more consensors when the number of active archivers is less than 4
extraConsensorsToSubscribe: 1 // Number of extra consensors to subscribe to
// For debugging gossip data, set this to true. This will save only the gossip data received from the gossip archivers.
saveOnlyGossipData: boolean
// For debugging purpose, set this to true to stop gossiping tx data
stopGossipTxData: boolean
}

let config: Config = {
Expand Down Expand Up @@ -120,6 +124,8 @@ let config: Config = {
randomGossipArchiversCount: 2,
subscribeToMoreConsensors: true,
extraConsensorsToSubscribe: 1,
saveOnlyGossipData: false,
stopGossipTxData: false,
}
// Override default config params from config file, env vars, and cli args
export async function overrideDefaultConfig(file: string): Promise<void> {
Expand Down
3 changes: 0 additions & 3 deletions src/Data/Collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ interface MissingTx {
senders: string[]
}

// For debugging gossip data, set this to true. This will save only the gossip data received from the gossip archivers.
export const saveOnlyGossipData = false

type GET_TX_RECEIPT_RESPONSE = {
success: boolean
receipt?: Receipt.ArchiverReceipt | Receipt.AppliedReceipt2
Expand Down
5 changes: 2 additions & 3 deletions src/Data/Data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
storeAccountData,
storingAccountData,
storeOriginalTxData,
saveOnlyGossipData,
} from './Collector'
import * as CycleDB from '../dbstore/cycles'
import * as ReceiptDB from '../dbstore/receipts'
Expand Down Expand Up @@ -258,7 +257,7 @@ export function initSocketClient(node: NodeList.ConsensusNodeInfo): void {
storeOriginalTxData(
newData.responses.ORIGINAL_TX_DATA,
sender.nodeInfo.ip + ':' + sender.nodeInfo.port,
saveOnlyGossipData
config.saveOnlyGossipData
)
}
if (newData.responses && newData.responses.RECEIPT) {
Expand All @@ -274,7 +273,7 @@ export function initSocketClient(node: NodeList.ConsensusNodeInfo): void {
newData.responses.RECEIPT,
sender.nodeInfo.ip + ':' + sender.nodeInfo.port,
true,
saveOnlyGossipData
config.saveOnlyGossipData
)
}
if (newData.responses && newData.responses.CYCLE) {
Expand Down
5 changes: 1 addition & 4 deletions src/Data/GossipData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ export interface GossipData {
sign: Signature
}

// For debugging purpose, set this to true to stop gossiping tx data
const stopGossipTxData = false

// List of archivers that are not adjacent to the current archiver
const remainingArchivers = []

Expand Down Expand Up @@ -69,7 +66,7 @@ export async function sendDataToAdjacentArchivers(
dataType: DataType,
data: GossipData['data']
): Promise<void> {
if (stopGossipTxData) return
if (config.stopGossipTxData) return
if (State.otherArchivers.length === 0) return
const gossipPayload = {
dataType,
Expand Down

0 comments on commit b80f544

Please sign in to comment.