File tree 1 file changed +7
-9
lines changed
1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -366,25 +366,23 @@ func (s *syncService) adaptAndSanityCheckBlock(ctx context.Context, header *spec
366
366
}
367
367
368
368
if blockVer .LessThan (core .Ver0_13_2 ) {
369
+ p2pHash , err := s .blockchain .BlockP2PHashByNumber (coreBlock .Number )
370
+ if err != nil {
371
+ bodyCh <- blockBody {err : fmt .Errorf ("failed to get p2p hash: %w" , err )}
372
+ return
373
+ }
374
+
369
375
expectedHash , _ , err := core .Post0132Hash (coreBlock , stateDiff )
370
376
if err != nil {
371
377
bodyCh <- blockBody {err : fmt .Errorf ("failed to compute p2p hash: %w" , err )}
372
378
return
373
379
}
374
380
375
- if ! coreBlock . Hash .Equal (expectedHash ) {
381
+ if ! p2pHash .Equal (expectedHash ) {
376
382
err = fmt .Errorf ("received p2p hash %v doesn't match expected %v" , coreBlock .Hash , expectedHash )
377
383
bodyCh <- blockBody {err : err }
378
384
return
379
385
}
380
-
381
- // once we verified p2p hash with received one above
382
- // we need to overwrite it with old scheme hash
383
- coreBlock .Hash , err = core .BlockHash (coreBlock )
384
- if err != nil {
385
- bodyCh <- blockBody {err : fmt .Errorf ("failed to generate block hash: %w" , err )}
386
- return
387
- }
388
386
}
389
387
390
388
stateUpdate := & core.StateUpdate {
You can’t perform that action at this time.
0 commit comments