-
Notifications
You must be signed in to change notification settings - Fork 5
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
Refactor to allow reconnection to SHiP endpoints after connection lost. #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
There were two issues this change exposed. |
For eosnetworkfoundation/silkworm#39 It is decided that we should fix it by not calling insert and verify for blocks that are already in canonical chain. Need update this PR. |
during reconnection to SHiP.
Updated the logic. Now incoming duplicated eos blocks will be discarded instead of triggering the fork logic. |
Resolve eosnetworkfoundation/eos-evm-contract#579
The changes:
1 Connection is moved from plugin_init to plugin_startup
2 Most network related errors will result in reset_connection() instead of sys::error()
3 Some errors such as cannot read block from db will still cause sys::error()
4 reset_connection() will send a close frame to existing connection (regardless success or not) and try resetting the connection.
a it will delay a configurable time before trying reconnection (default 10s)
b it will try at most a configurable times (default 0, means it will not try reconnection at all), after reaching the limit it will call sys::error() to exit
c If the system successfully reconnect to SHiP and read blocks properly, the reconnection count will be reset to 0
The PR also include a minor fix to work around the issue:
eosio::json_token_stream will fail if the input string is not zero terminated.
Fixed by adding the terminating zero.