Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circumstances where the chain flips regardless of TotalDifficultyCompare. #1349

Closed
riemannulus opened this issue Jun 23, 2021 · 2 comments
Closed
Assignees
Labels
bug Something isn't working consensus Related to blockchain consensus stale The issue is stale

Comments

@riemannulus
Copy link
Member

A slightly strange log was detected.

[15:52:38 DBG] 815992201/1598638844: Block #1745949 e394a727e9a78f42f4c3e81c1e68e5ed2de38c42befd22bb6facda8849d5d6dd was appended.
[15:52:38 DBG] Downloaded 1 block(s) from 0x4d92cd06Fc559520d038BDA3bBc63a9e51b76e72.Unspecified/3.22.224.238:50586.42.189.229.92.
[15:52:38 DBG] 815992201/1598638844: Got 1 blocks from Peer 4d92cd06Fc559520d038BDA3bBc63a9e51b76e72 (tip: #1745949 e394a727e9a78f42f4c3e81c1e68e5ed2de38c42befd22bb6facda8849d5d6dd)
[15:52:38 DBG] 815992201: FillBlocksAsync() completed (chain ID: 85b185bc-70e1-461e-aeb7-66a554b760a0, tip: #1745949 e394a727e9a78f42f4c3e81c1e68e5ed2de38c42befd22bb6facda8849d5d6dd).
[15:52:38 DBG] 815992201: Finished FillBlocksAsync().
[15:52:38 DBG] 815992201: Swap the chain 8780651b-241a-47f5-8af0-4015cfc10f1c for the chain 85b185bc-70e1-461e-aeb7-66a554b760a0...
[15:52:38 DBG] The blockchain was reorged from 8780651b-241a-47f5-8af0-4015cfc10f1c (#1745950 314ed0ee12c64df8aaa77946e61caf360ee9c56fdcf5d362fc5b3b9db39b7829) to 85b185bc-70e1-461e-aeb7-66a554b760a0 (#1745949 e394a727e9a78f42f4c3e81c1e68e5ed2de38c42befd22bb6facda8849d5d6dd).

Note the chain is swapped to the wrong chain.
image

And I found some strange code on Swarm.BlockSync.SyncPreviousBlockSync().
https://github.com/planetarium/libplanet/blob/2eaab5a8b1/Libplanet/Net/Swarm.BlockSync.cs#L175

May this code cause wrong logic if the chain tip is null.

PS. I attach some code snippets and chain data for the debug.
https://gist.github.com/riemannulus/8e24f9a99aaad16db41a0ee2fb8bc1f4
https://download.nine-chronicles.com/miner.tar.gz

@riemannulus riemannulus added bug Something isn't working consensus Related to blockchain consensus labels Jun 23, 2021
@longfin longfin self-assigned this Jun 23, 2021
@dahlia dahlia changed the title Circumstances where the chain flips regardless of TotalDifficultyCompaire. Circumstances where the chain flips regardless of TotalDifficultyCompare. Jun 24, 2021
@stale
Copy link

stale bot commented Aug 24, 2021

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale The issue is stale label Aug 24, 2021
@longfin
Copy link
Member

longfin commented Nov 12, 2021

As there are no additional reports, this issue is closed for now. After that, please open it when there is a related report.

@longfin longfin closed this as completed Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working consensus Related to blockchain consensus stale The issue is stale
Projects
None yet
Development

No branches or pull requests

2 participants