Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLUE-212 Fix the issue of original standby nodelist data getting mutated due to standbyRefresh nodes #239

Closed
wants to merge 1 commit into from
Closed
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: 3 additions & 1 deletion src/p2p/Join/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { reset as resetAcceptance } from './acceptance'
import { stringifyReduce } from '../../../utils/functions/stringifyReduce'
import { logFlags } from '../../../logger'
import { Utils } from '@shardus/types'
import { deepCopy } from '../../../utils'

const clone = rfdc()

Expand Down Expand Up @@ -145,7 +146,8 @@ export function getSortedStandbyJoinRequests(): JoinRequest[] {
export function computeNewStandbyListHash(): hexstring {
if (config.p2p.standbyListFastHash) {
//this field must be udpated as it is used by other functions
lastHashedList = Array.from(getSortedStandbyJoinRequests())
const standbyNodeList = Array.from(getSortedStandbyJoinRequests())
lastHashedList = deepCopy(standbyNodeList) // Using deepCopy to avoid mutating the original list by standbyRefresh later
//sort hashes by value. could sort by ID, but this is a bit faster

const hashes = Array.from(standbyNodesInfoHashes.values())
Expand Down
Loading