feat(net): improve chain inventory generating logic#5393
feat(net): improve chain inventory generating logic#5393halibobo1205 merged 1 commit intotronprotocol:developfrom
Conversation
| LinkedList<BlockId> ids = getBlockIds(unForkId.getNum()); | ||
|
|
||
| if (ids.isEmpty() || !unForkId.equals(ids.peekFirst())) { | ||
| unForkId = getUnForkId(blockIds); |
There was a problem hiding this comment.
If I'm not mistaken, is it just a retry?
There was a problem hiding this comment.
Yes, it can be solved by retrying.
| boolean f = (boolean)method.invoke(handler, peer, message); | ||
| Assert.assertTrue(!f); | ||
|
|
||
| Method method1 = handler.getClass().getDeclaredMethod( |
There was a problem hiding this comment.
Is it possible to reproduce this scenario without using reflection?
There was a problem hiding this comment.
Okay, further optimization.
|
It only happened with the forks which are not finalized? If so, all the blocks on both(or more) forks are stored in memory? If all the above is right, just sending the corresponding blocks can solve this thoroughly? |
yes
This problem will only involve non-solidified blocks.
After the chain switch is completed, the generated inventory is without any problems. |
I mean generating the inventory by iterating the specified fork instead of using |
tomatoishealthy
left a comment
There was a problem hiding this comment.
Approved, @wubin01 should do a double check
| @@ -87,6 +87,18 @@ private boolean check(PeerConnection peer, SyncBlockChainMessage msg) throws P2p | |||
|
|
|||
| private LinkedList<BlockId> getLostBlockIds(List<BlockId> blockIds) throws P2pException { | |||
What does this PR do?
Retrying inventory generating if first blockId does not match the chain summary.
Why are these changes required?
This PR has been tested by:
Follow up
Extra details