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

rpc: checkblock, add checkBlock() to Mining interface #75

Closed
wants to merge 6 commits into from

Conversation

Sjors
Copy link
Owner

@Sjors Sjors commented Dec 21, 2024

RPC and IPC for checking weak blocks (reduced proof of work) and block templates (no proof of work) against all consensus rules.

Uses the first test commit from bitcoin#31283 to refactor miner_tests.cpp.

@plebhash
Copy link

this can be useful for Sv2 JDS to check template validity

cc @GitGab19

@Sjors Sjors force-pushed the 2024/12/check-block branch from 146459b to 02801f1 Compare December 24, 2024 08:41
@Sjors
Copy link
Owner Author

Sjors commented Dec 24, 2024

Simplified things by just calling ConnectBlock instead of copy-pasting it.

@Sjors Sjors force-pushed the 2024/12/check-block branch 4 times, most recently from 972f752 to 022f4be Compare December 24, 2024 10:27
@Sjors
Copy link
Owner Author

Sjors commented Dec 24, 2024

Also added checkBlock() to the Mining interface. If the JDS can speak cap&proto this should be more performant than using the RPC. Though it's probably not a huge difference.

@Sjors Sjors changed the title rpc: checkblock rpc: checkblock, add checkBlock() to Mining interface Dec 24, 2024
@Sjors Sjors force-pushed the 2024/12/check-block branch 2 times, most recently from ef49610 to 768e0db Compare December 24, 2024 14:07
@Sjors
Copy link
Owner Author

Sjors commented Dec 24, 2024

I got rid of StateCatcher indirection. With a little bit more cleanup I can probably open a PR to the main repo.

Would be nice if someone can demonstrate usage of the new RPC. E.g. the SRI Job Declarator Server could call it from here: https://github.com/stratum-mining/stratum/blob/main/roles/jd-server/src/lib/job_declarator/message_handler.rs#L204

Alternate calls between Chainman's ProcessNewBlock and submitSolution. The Chainman code path is used in production, so it's important to keep test coverage for it.

Use createNewBlock via the interface instead of using the BlockAssembler directly. The latter is always called via the interface in production code.
@Sjors Sjors force-pushed the 2024/12/check-block branch from 768e0db to 442f27a Compare December 24, 2024 15:49
@Sjors
Copy link
Owner Author

Sjors commented Dec 24, 2024

Further cleanup.

@Sjors
Copy link
Owner Author

Sjors commented Dec 24, 2024

Moving to bitcoin#31564.

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