Skip to content

Instantly share code, notes, and snippets.

this.p2p.registerInternal(
'repair_oos_accounts',
async (
payload: {repairInstructions: AccountRepairInstruction[]},
respond: (arg0: boolean) => Promise<boolean>,
_sender: unknown,
_tracker: string,
msgSize: number
) => {
profilerInstance.scopedProfileSectionStart('repair_oos_accounts', false, msgSize)
try {
for (const repairInstruction of payload?.repairInstructions) {
const { accountID, txId, hash, accountData, targetNodeId, receipt2 } = repairInstruction // @audit insufficient validation of voting data
/* snippet of code */
// update the account data (and cache?)
const updatedAccounts: string[] = []
//save the account data. note this will make sure account hashes match the wrappers and return failed
// hashes that don't match
const failedHashes = await this.stateManager.checkAndSetAccountData(
[accountData],
`repair_oos_accounts:${txId}`,
true,
updatedAccounts
)
/* snippet of code */
}
await respond(true)
} catch (e) {
}
profilerInstance.scopedProfileSectionEnd('repair_oos_accounts')
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment