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

Stratum v2 Template Provider common functionality #49

Open
wants to merge 16 commits into
base: 2024/06/sv2_connection
Choose a base branch
from

Conversation

@Sjors
Copy link
Owner Author

Sjors commented Aug 13, 2024

Updated to the latest interface changes proposed in bitcoin#30409 and #53.

@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from b549fd6 to 22d033c Compare August 13, 2024 17:14
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch 2 times, most recently from 491755c to 16d2381 Compare August 13, 2024 18:07
@Sjors Sjors force-pushed the 2024/06/sv2_connection branch 3 times, most recently from 4f957ee to b69544c Compare August 29, 2024 11:49
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch 2 times, most recently from ca73422 to 4fa25e0 Compare August 29, 2024 11:59
@Sjors
Copy link
Owner Author

Sjors commented Aug 29, 2024

Rebased for CMake

@Sjors
Copy link
Owner Author

Sjors commented Aug 30, 2024

One test still seems brittle:

src/test/sv2_template_provider_tests.cpp(256): fatal error: in "sv2_template_provider_tests/client_tests": critical check tester.GetBlockTemplateCount() == 3 has failed [2 != 3]

@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from b69544c to 1ca68d2 Compare September 5, 2024 12:57
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch from 1f720ff to 1912743 Compare September 5, 2024 15:56
@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from 1ca68d2 to b578e0a Compare September 10, 2024 14:54
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch 2 times, most recently from 598f08a to 436dc4d Compare September 11, 2024 05:39
@Sjors
Copy link
Owner Author

Sjors commented Sep 11, 2024

Moved TemplateProvider from node to common so that in #48 bitcoin-mine does not depend on bitcoin-node.

@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch from 436dc4d to 46fa8f1 Compare September 11, 2024 06:37
@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from b578e0a to 489c9fb Compare September 19, 2024 15:02
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch 2 times, most recently from 7db898e to 765af74 Compare September 19, 2024 16:13
@Sjors
Copy link
Owner Author

Sjors commented Feb 10, 2025

Possible thread issue, found by CI in #68: https://cirrus-ci.com/task/5072000852426752?logs=ci#L3303

@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from 2503578 to 360aedd Compare February 10, 2025 14:31
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch from 6b5dfc5 to fe053b0 Compare February 10, 2025 14:40
@Sjors
Copy link
Owner Author

Sjors commented Feb 10, 2025

Rebased after bitcoin#31384.

@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from 360aedd to 49ea07a Compare February 21, 2025 15:07
Sjors and others added 16 commits February 21, 2025 16:09
This was preventing the (hidden) waitfornewblock, waitforblock and
waitforblockheight methods from being used in the GUI.

The check was added in d6a5dc4
when these RPC methods were first introduced.

They could have been dropped when dca9231
refactored these methods to use waitTipChanged(), which already
checks for shutdown.

Making this change now simplifies the next commit.
The waitTipChanged() now returns nullopt if the node is shutting down.

Previously it would return the last known tip during shutdown, but
this creates an ambiguous circumstance in the scenario where the
node is started and quickly shutdown, before notifications().TipBlock()
is set.

The getblocktemplate, waitfornewblock and waitforblockheight RPC
are updated to handle this. Existing behavior is preserved.

Co-authored-by: Ryan Ofsky <[email protected]>
Additionally it returns null if the node started to shutdown before TipBlock() was set.
Move the comparison to hashWatchedChain inside the while loop.

Although this early return prevents the GetTransactionsUpdated()
call in cases where the tip updates, it's only done to improve
readability. The check itself is very cheap (although a more
useful check might not be).

Also add code comments.
On testnet we need to create a min diff template after 20 min.
The template provider will listen for a Job Declarator client.
It can establish a connection and detect various protocol errors.

Co-Authored-By: Christopher Coverdale <[email protected]>
Co-Authored-By: Fi3
Co-authored-by: Christopher Coverdale <[email protected]>
Determine future_template only once
@Sjors Sjors force-pushed the 2024/07/sv2-tp-common branch from fe053b0 to 5c3f9cb Compare February 21, 2025 15:14
@Sjors
Copy link
Owner Author

Sjors commented Feb 21, 2025

Rebased in hopes of making #80 magically go away.

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.

1 participant