Skip to content

Commit 5a51e49

Browse files
committed
delete process handle success
1 parent e78c9a1 commit 5a51e49

2 files changed

Lines changed: 11 additions & 19 deletions

File tree

src/main/java/org/tron/core/net/node/AdvBlockDisorder.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
* @description: This class is for Mapping Util using.
1515
* The member variable map is used for store the block's parent hash(key)
1616
* and the PeerAndBlockCapsule(value).
17-
* When we handle a block unsuccessfully because of UnLinkedBlockException, we
18-
* add the parent hash and the PeerAndBlockCapsule to the map.
19-
* When we handle a block successfully,we can search whether his child block
20-
* exists in the map, and we can handle this child simultaneously.
21-
* @author: shydesky@gmail.com
22-
* @create: 2018-07-13
17+
* When we receive a disordered block, we
18+
* add the (parent hash, PeerAndBlockCapsule) to the map.
19+
* When we receive a ordered block and handle it, if success, we can search whether his child block
20+
* exists in the map, and we can handle this child simultaneously, if failure, we remove the his child block
2321
**/
2422
public class AdvBlockDisorder {
2523
private HashMap<Sha256Hash, PeerAndBlockCapsule> map;

src/main/java/org/tron/core/net/node/NodeImpl.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -759,20 +759,14 @@ private void processAdvBlock(PeerConnection peer, BlockCapsule block) {
759759
}else{
760760
// receive an ordered block we have requested, try to push block
761761
advObjWeRequested.remove(block.getBlockId());
762-
boolean isSuccess = true;
763-
while (isSuccess) {
764-
isSuccess = realProcessAdvBlock(peer, block);
765-
if (isSuccess) {
766-
// if push block success, we try to find his child block and continue push
767-
AdvBlockDisorder.PeerAndBlockCapsule blockAndPeer = advBlockDisorder.getNextBlockAndRemove(block);
768-
if(blockAndPeer == null){
769-
break;
770-
}
771-
block = blockAndPeer.getBlockCapsule();
772-
peer = blockAndPeer.getPeer();
773-
}else{
774-
advBlockDisorder.remove(block);
762+
while (realProcessAdvBlock(peer, block)) {
763+
// if push block success, we try to find his child block and continue push
764+
AdvBlockDisorder.PeerAndBlockCapsule blockAndPeer = advBlockDisorder.getNextBlockAndRemove(block);
765+
if(blockAndPeer == null){
766+
break;
775767
}
768+
block = blockAndPeer.getBlockCapsule();
769+
peer = blockAndPeer.getPeer();
776770
}
777771
}
778772
}

0 commit comments

Comments
 (0)