File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed
src/main/java/org/tron/core/db Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -350,6 +350,7 @@ public BlockCapsule getParentBlock(Sha256Hash hash) {
350
350
.map (KhaosBlock ::getParent )
351
351
.map (khaosBlock -> khaosBlock == null ? null : khaosBlock .blk )
352
352
.filter (Objects ::nonNull )
353
+ .filter (b -> containBlock (b .getBlockId ()))
353
354
.findFirst ()
354
355
.orElse (null );
355
356
}
Original file line number Diff line number Diff line change @@ -594,9 +594,8 @@ private void switchFork(BlockCapsule newHead)
594
594
logger .info ("there is not the most recent common ancestor, need to remove all blocks in the fork chain." );
595
595
BlockCapsule tmp = newHead ;
596
596
while (tmp != null ) {
597
- BlockCapsule parent = khaosDb .getParentBlock (tmp .getBlockId ());
598
597
khaosDb .removeBlk (tmp .getBlockId ());
599
- tmp = parent ;
598
+ tmp = khaosDb . getBlock ( tmp . getParentHash ()) ;
600
599
}
601
600
602
601
throw e ;
You can’t perform that action at this time.
0 commit comments