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(rpc): Mine standard and minimum difficulty blocks on testnet #5747

Merged
merged 6 commits into from
Dec 2, 2022

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Nov 30, 2022

Motivation

In PR #5659, I added a check for testnet minimum difficulty blocks. But it accidentally made all the mined blocks on testnet into minimum difficulty blocks.

Depends-On: #5761

Solution

Check if the current time is close to the minimum difficulty time (2 target block intervals). If it is, use a minimum difficulty block. If there is plenty of time, use a standard difficulty block.

Split the testnet adjustment into its own function.

Cleanup some names and constants.

Review

This is a routine bug fix, @oxarbitrage might want to review it.

Reviewer Checklist

  • Will the PR name make sense to users?
    • Does it need extra CHANGELOG info? (new features, breaking changes, large changes)
  • Are the PR labels correct?
  • Does the code do what the ticket and PR says?
  • How do you know it works? Does it have tests?

@teor2345 teor2345 added C-bug Category: This is a bug P-Medium ⚡ A-rpc Area: Remote Procedure Call interfaces A-state Area: State / database changes labels Nov 30, 2022
@teor2345 teor2345 requested a review from a team as a code owner November 30, 2022 03:15
@teor2345 teor2345 self-assigned this Nov 30, 2022
@teor2345 teor2345 requested review from arya2 and removed request for a team November 30, 2022 03:15
@codecov
Copy link

codecov bot commented Nov 30, 2022

Codecov Report

Merging #5747 (e26c1c4) into main (afdb3a7) will decrease coverage by 0.08%.
The diff coverage is 0.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5747      +/-   ##
==========================================
- Coverage   78.79%   78.71%   -0.09%     
==========================================
  Files         306      306              
  Lines       38702    38702              
==========================================
- Hits        30496    30463      -33     
- Misses       8206     8239      +33     

@teor2345
Copy link
Contributor Author

Failed due to #5384 😭

Base automatically changed from nightly-build-errors to main November 30, 2022 07:03
@mergify mergify bot requested a review from a team as a code owner November 30, 2022 07:03
@teor2345 teor2345 requested review from oxarbitrage and removed request for a team November 30, 2022 19:36
@teor2345 teor2345 changed the base branch from main to check-anchors-in-parallel November 30, 2022 23:03
@teor2345 teor2345 changed the base branch from check-anchors-in-parallel to main November 30, 2022 23:03
@teor2345
Copy link
Contributor Author

teor2345 commented Dec 1, 2022

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Dec 1, 2022

update

☑️ Nothing to do

  • #commits-behind>0 [:pushpin: update requirement]
  • -closed [:pushpin: update requirement]

zebra-state/src/service/read/difficulty.rs Outdated Show resolved Hide resolved
zebra-state/src/service/read/difficulty.rs Outdated Show resolved Hide resolved
@teor2345 teor2345 requested a review from arya2 December 1, 2022 21:13
Copy link
Contributor

@arya2 arya2 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!

mergify bot added a commit that referenced this pull request Dec 1, 2022
@mergify mergify bot merged commit 21c916f into main Dec 2, 2022
@mergify mergify bot deleted the fix-gbt-time-testnet-min branch December 2, 2022 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Area: Remote Procedure Call interfaces A-state Area: State / database changes C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants