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

fix: address several sync issues and remove a potential deadlock #247

Merged
merged 5 commits into from
Mar 8, 2024

Conversation

HashEngineering
Copy link
Collaborator

@HashEngineering HashEngineering commented Mar 1, 2024

Issue being fixed or feature implemented

The goal is to reduce the changes of a deadlock and to fix other minor issues.

What was done?

How Has This Been Tested?

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Signed-off-by: HashEngineering <[email protected]>
* improve logging with sendRequestWithRetry

* count mnlistdiff size on Request not Complete

* add fulfilled field to lastRequest and use it

Signed-off-by: HashEngineering <[email protected]>
@HashEngineering HashEngineering self-assigned this Mar 1, 2024
protocolVersion = NetworkParameters.ProtocolVersion.SMNLE_VERSIONED.getBitcoinProtocolVersion();
protocolVersion = NetworkParameters.ProtocolVersion.CURRENT.getBitcoinProtocolVersion();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes a problem where v20 bootstrap files cannot be loaded.

Comment on lines -533 to +529
blockChain.addNewBestBlockListener(Threading.SAME_THREAD, newBestBlockListener);
blockChain.addNewBestBlockListener(newBestBlockListener);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If newBestBlockListener is running in SAME_THREAD, then it will be running under an AbstractBlockChain lock which may be a cause of the deadlock I am trying to fix.

This is the only listener running in the same thread.

Comment on lines +1238 to +1244
if (peer != null) {
peer.queueMasternodeListDownloadedListeners(MasternodeListDownloadedListener.Stage.Received, quorumRotationInfo.getMnListDiffTip());
peer.queueMasternodeListDownloadedListeners(MasternodeListDownloadedListener.Stage.Received, quorumRotationInfo.getMnListDiffAtH());
peer.queueMasternodeListDownloadedListeners(MasternodeListDownloadedListener.Stage.Received, quorumRotationInfo.getMnListDiffAtHMinusC());
peer.queueMasternodeListDownloadedListeners(MasternodeListDownloadedListener.Stage.Received, quorumRotationInfo.getMnListDiffAtHMinus2C());
peer.queueMasternodeListDownloadedListeners(MasternodeListDownloadedListener.Stage.Received, quorumRotationInfo.getMnListDiffAtHMinus3C());
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the goal here is to count qrinfo messages in the bandwidth calculations.

Copy link

codecov bot commented Mar 1, 2024

Codecov Report

Attention: Patch coverage is 53.57143% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 48.00%. Comparing base (76b7d6c) to head (ac8f7f9).

❗ Current head ac8f7f9 differs from pull request most recent head 4fb46e0. Consider uploading reports for the commit 4fb46e0 to get more accurate results

Files Patch % Lines
...va/org/bitcoinj/evolution/AbstractQuorumState.java 28.57% 5 Missing ⚠️
...va/org/bitcoinj/evolution/QuorumRotationState.java 37.50% 4 Missing and 1 partial ⚠️
...ore/src/main/java/org/bitcoinj/core/PeerGroup.java 0.00% 1 Missing ⚠️
.../main/java/org/bitcoinj/evolution/QuorumState.java 80.00% 0 Missing and 1 partial ⚠️
...va/org/bitcoinj/evolution/QuorumUpdateRequest.java 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #247      +/-   ##
============================================
+ Coverage     47.99%   48.00%   +0.01%     
- Complexity     6665     6669       +4     
============================================
  Files           409      409              
  Lines         46120    46128       +8     
  Branches       6503     6502       -1     
============================================
+ Hits          22133    22146      +13     
+ Misses        21574    21572       -2     
+ Partials       2413     2410       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@HashEngineering HashEngineering marked this pull request as ready for review March 7, 2024 15:25
Copy link
Member

@Syn-McJ Syn-McJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@HashEngineering HashEngineering merged commit 5805914 into master Mar 8, 2024
4 of 5 checks passed
@HashEngineering HashEngineering deleted the bugfix-sync-deadlocks-two branch April 30, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants