Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export function registerRoutes(server: FastifyInstance<Server, IncomingMessage,
publicKey,
}

Data.initSocketClient(firstNode)
Data.initSocketClientWithDataSenders(firstNode)

ArchiverLogging.logValidatorConnection({
validatorId: signedFirstNodeInfo.nodeInfo.publicKey,
Expand All @@ -194,7 +194,7 @@ export function registerRoutes(server: FastifyInstance<Server, IncomingMessage,
types: [P2PTypes.SnapshotTypes.TypeNames.CYCLE, P2PTypes.SnapshotTypes.TypeNames.STATE_METADATA],
contactTimeout: Data.createContactTimeout(firstNode.publicKey, 'This timeout is created for the first node'),
}
Data.addDataSender(firstDataSender)
Data.addDataSenderWithDataSenders(firstDataSender)
let res: P2P.FirstNodeResponse

if (config.experimentalSnapshot) {
Expand Down
4 changes: 3 additions & 1 deletion src/Data/Collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import * as Receipt from '../dbstore/receipts'
import * as OriginalTxsData from '../dbstore/originalTxsData'
import * as ProcessedTransaction from '../dbstore/processedTxs'
import * as Crypto from '../Crypto'
import { clearCombinedAccountsData, combineAccountsData, collectCycleData } from './Data'
import { clearCombinedAccountsData, collectCycleData } from './Data'
import { getCombinedAccountsData } from './accountData'
import { config } from '../Config'
import * as Logger from '../Logger'
import { nestedCountersInstance } from '../profiler/nestedCounters'
Expand Down Expand Up @@ -1285,6 +1286,7 @@ export const storeAccountData = async (restoreData: StoreAccountParam = {}): Pro
await ProcessedTransaction.bulkInsertProcessedTxs(combineProcessedTxs)
}
if (profilerInstance) profilerInstance.profileSectionEnd('store_account_data')
const combineAccountsData = getCombinedAccountsData()
Logger.mainLogger.debug('Combined Accounts Data', combineAccountsData.accounts.length)
if (combineAccountsData.accounts.length > 0 || combineAccountsData.receipts.length > 0) {
Logger.mainLogger.debug('Found combine accountsData', combineAccountsData.accounts.length)
Expand Down
20 changes: 10 additions & 10 deletions src/Data/Cycles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
clearDataSenders,
dataSenders,
getConsensusRadius,
nodesPerConsensusGroup,
nodesPerEdge,
subscribeConsensorsByConsensusRadius,
subscribeConsensorsByConsensusRadiusWithDataSenders,
subscriptionCycleData,
unsubscribeDataSender,
unsubscribeDataSenderWithDataSenders,
nodesPerConsensusGroup,
nodesPerEdge
} from './Data'
import * as Utils from '../Utils'
import { config } from '../Config'
Expand Down Expand Up @@ -233,17 +233,17 @@
}

const cycleRecordWithoutMarker = { ...cycleRecord }
delete cycleRecordWithoutMarker.marker
delete (cycleRecordWithoutMarker as any).marker

const computedMarker = computeCycleMarker(cycleRecordWithoutMarker)
const computedMarker = computeCycleMarker(cycleRecordWithoutMarker as P2PTypes.CycleCreatorTypes.CycleRecord)
Logger.mainLogger.debug(
'validateCycleData: Computed marker: ',
computedMarker,
' Provided marker: ',
cycleRecord.marker
(cycleRecord as any).marker

Check warning

Code scanning / CodeQL

Log injection Medium

Log entry depends on a
user-provided value
.
)

if (computedMarker !== cycleRecord.marker) {
if (computedMarker !== (cycleRecord as any).marker) {
Logger.mainLogger.error('Invalid Cycle Record: cycle marker does not match with the computed marker')
return false
}
Expand Down Expand Up @@ -372,7 +372,7 @@
const nodesToUnsubscribed = [...apoptosizedPks, ...removedPks]
if (nodesToUnsubscribed.length > 0) {
for (const key of nodesToUnsubscribed) {
if (dataSenders.has(key)) unsubscribeDataSender(key)
if (dataSenders.has(key)) unsubscribeDataSenderWithDataSenders(key)
}
}
if (removedConsensusNodes.length > 0 || apoptosizedConsensusNodes.length > 0) {
Expand All @@ -390,7 +390,7 @@
NodeList.realUpdatedTimes.set('/full-nodelist', Date.now())
// To pick nodes only when the archiver is active
if (State.isActive) {
subscribeConsensorsByConsensusRadius()
subscribeConsensorsByConsensusRadiusWithDataSenders()
}
}

Expand Down
Loading
Loading