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: masternode list sync and block reward #240

Merged
merged 5 commits into from
Dec 19, 2023

Conversation

HashEngineering
Copy link
Collaborator

Issue being fixed or feature implemented

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

…the last qrinfo list

* The QRInfo list may be up to 12 hours old

* this resolves a masternode list sync bug when requesting mnlistdiff

Signed-off-by: HashEngineering <[email protected]>
@HashEngineering HashEngineering self-assigned this Dec 18, 2023
Comment on lines +201 to +203
public boolean isHPMN() {
return type == MasternodeType.HIGHPERFORMANCE.index;
}
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 is required by Dash Wallet for Masternode APY.

Comment on lines 453 to 459
public SimplifiedMasternodeList getListAtChainTip() {
return getMasternodeList();
if (quorumState.getMasternodeListAtTip() != null) {
return quorumState.getMasternodeListAtTip();
} else {
return quorumRotationState.getMnListAtH();
}
}
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 helps fix a sync issue. When checking if mnlistdiff needs to be requested, we were actually checking the wrong list from qrinfo. Additionally in Dash Wallet, the block height used for the CrowdNode APY was from qrinfo which could be up to 12 hours old, rather than the most recent masternode list block height.

Comment on lines +270 to +271
int treasuryPart = params.isV20Active(nPrevHeight) ? 20 : 10; // parts per 100, 20 is 20%
Coin nSuperblockPart = (nPrevHeight > params.getBudgetPaymentsStartBlock()) ? nSubsidy.multiply(treasuryPart).div(100) : Coin.ZERO;
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 updates for the new Treasury size of 20% once v20 is active.

Copy link

codecov bot commented Dec 18, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (0ce9035) 48.00% compared to head (5724ea7) 48.02%.
Report is 1 commits behind head on master.

❗ Current head 5724ea7 differs from pull request most recent head 6a9e8dd. Consider uploading reports for the commit 6a9e8dd to get more accurate results

Files Patch % Lines
...inj/evolution/SimplifiedMasternodeListManager.java 0.00% 3 Missing ⚠️
core/src/main/java/org/bitcoinj/core/Block.java 0.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #240      +/-   ##
============================================
+ Coverage     48.00%   48.02%   +0.01%     
+ Complexity     6666     6665       -1     
============================================
  Files           409      409              
  Lines         46110    46117       +7     
  Branches       6502     6503       +1     
============================================
+ Hits          22136    22148      +12     
+ Misses        21570    21557      -13     
- Partials       2404     2412       +8     

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

Comment on lines -414 to +415
quorumState.initChainTipSyncComplete = false;
quorumRotationState.initChainTipSyncComplete = false;
quorumState.close();
quorumRotationState.close();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

need to reset more of the sync state than this one value.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

One reason for "Syncing..." was that it was waiting for a reply to a message sent before the network was completely disconnected. After starting up, the wait flag was still set to true. While waiting, we don't request again.

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 3b61c68 into master Dec 19, 2023
5 checks passed
@HashEngineering HashEngineering deleted the bugfix-sync-block-reward branch January 10, 2024 19:39
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