Skip to content

Ignore unchanged block-template refreshes and add test#132

Merged
MoneroOcean merged 6 commits into
masterfrom
codex/clarify-duplicate-template-issue
May 19, 2026
Merged

Ignore unchanged block-template refreshes and add test#132
MoneroOcean merged 6 commits into
masterfrom
codex/clarify-duplicate-template-issue

Conversation

@MoneroOcean
Copy link
Copy Markdown
Owner

Motivation

  • Avoid rotating and re-broadcasting block templates when a refreshed template is identical to the active one to preserve template-specific state and reduce unnecessary work.

Description

  • Add an early exit in setNewBlockTemplate to skip processing when the incoming template idHash matches the currently active template by using a previousTemplate reference.
  • Replace repeated lookups of activeBlockTemplates[coin] with a previousTemplate local variable and enqueue that into pastBlockTemplates when rotating.
  • Ensure the rotation logic still sets timeout values and isExtraCheck when necessary while using the previousTemplate variable.
  • Add a unit test template manager ignores unchanged template refreshes to tests/pool/components/core.js that verifies unchanged templates are ignored and that template-specific state (extraNonce, extraNonce2, sharedNonceSubmissions) is preserved, while a truly new template resets that state.

Testing

  • Ran the pool component unit tests including tests/pool/components/core.js via the project test suite, and the full test suite passed.
  • The new test template manager ignores unchanged template refreshes passed and confirms preserved state for identical templates and reset on new templates.

Codex Task

@MoneroOcean MoneroOcean merged commit 4b2645a into master May 19, 2026
0 of 2 checks passed
@MoneroOcean MoneroOcean deleted the codex/clarify-duplicate-template-issue branch May 19, 2026 21:59
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