feat(wallet): reject broadcastTransaction when head block is too old#10
Open
feat(wallet): reject broadcastTransaction when head block is too old#10
Conversation
Add a pre-flight check in Wallet.broadcastTransaction() that compares the head block timestamp against wall clock time. If the lag exceeds the configurable threshold (default 30s, min 3s), the request is rejected with a new HEAD_BLOCK_TOO_OLD response code. - Add HEAD_BLOCK_TOO_OLD = 13 to Return.response_code in api.proto - Add NODE_MAX_HEAD_BLOCK_TIME_DEVIATION config key and CommonParameter field - Load and clamp the config value in Args.applyConfigParams() - Add commented default entry in config.conf - Add two WalletMockTest cases covering the reject and pass-through paths Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a pre-flight check in Wallet.broadcastTransaction() that compares the head block timestamp against wall clock time. If the lag exceeds the configurable threshold (default 30s, min 3s), the request is rejected with a new HEAD_BLOCK_TOO_OLD response code.
What does this PR do?
Why are these changes required?
This PR has been tested by:
Follow up
Extra details