@@ -91,6 +91,10 @@ import {
91
91
import { BadRequest , InternalError , serializeResponseError } from '../types/ResponseError'
92
92
import { Utils } from '@shardus/types'
93
93
import { RepairOOSAccountsReq , deserializeRepairOOSAccountsReq , serializeRepairOOSAccountsReq } from '../types/RepairOOSAccountsReq'
94
+ import { robustQuery } from '../p2p/Utils'
95
+ import { RequestReceiptForTxReqSerialized , serializeRequestReceiptForTxReq } from '../types/RequestReceiptForTxReq'
96
+ import { deserializeRequestReceiptForTxResp , RequestReceiptForTxRespSerialized } from '../types/RequestReceiptForTxResp'
97
+ import { Node } from '../shardus/shardus-types'
94
98
95
99
type Line = {
96
100
raw : string
@@ -569,6 +573,49 @@ class AccountPatcher {
569
573
continue
570
574
}
571
575
576
+ const queryFn = async ( node : Node ) => {
577
+ const message = { txid : txId , timestamp : accountData . timestamp }
578
+ return await this . p2p . askBinary <
579
+ RequestReceiptForTxReqSerialized ,
580
+ RequestReceiptForTxRespSerialized
581
+ > (
582
+ node ,
583
+ InternalRouteEnum . binary_request_receipt_for_tx ,
584
+ message ,
585
+ serializeRequestReceiptForTxReq ,
586
+ deserializeRequestReceiptForTxResp ,
587
+ { }
588
+ )
589
+ }
590
+
591
+ // make sure tx hasn't been altered by robust querying for the proposal using request txid and timestamp
592
+ const txReceipt = await robustQuery ( storageNodes , queryFn )
593
+ if ( txReceipt . isRobustResult === false ) {
594
+ nestedCountersInstance . countEvent (
595
+ 'accountPatcher' ,
596
+ `binary/repair_oos_accounts: robust query failed for txId: ${ txId } `
597
+ )
598
+ continue
599
+ }
600
+
601
+ if ( txReceipt . topResult . success !== true
602
+ || txReceipt . topResult . receipt == null
603
+ || txReceipt . topResult . receipt . proposalHash == null ) {
604
+ nestedCountersInstance . countEvent (
605
+ 'accountPatcher' ,
606
+ `binary/repair_oos_accounts: robust query couldn't find queueEntry for txId: ${ txId } `
607
+ )
608
+ continue
609
+ }
610
+
611
+ if ( signedReceipt . proposalHash !== txReceipt . topResult . receipt . proposalHash ) {
612
+ nestedCountersInstance . countEvent (
613
+ 'accountPatcher' ,
614
+ `binary/repair_oos_accounts: proposal hash mismatch for txId: ${ txId } `
615
+ )
616
+ continue
617
+ }
618
+
572
619
// if (receivedBestVote != null) {
573
620
// Check if vote is from eligible list of voters for this TX
574
621
// if (
0 commit comments