wire: Clamp max allowed timestamp values.#3615
Merged
davecgh merged 2 commits intodecred:masterfrom Feb 25, 2026
Merged
Conversation
a26048f to
cb9f6e9
Compare
jholdstock
reviewed
Feb 18, 2026
cb9f6e9 to
dc40cad
Compare
jholdstock
approved these changes
Feb 19, 2026
dc40cad to
80bb930
Compare
jrick
approved these changes
Feb 24, 2026
This adds a couple of tests to ensure a couple of the newer error codes produce the expected human-readable output that were missed when adding them. It also adds a new define to the enum to count how many there are along with a test to detect missing entries.
This modifies the code that deals with serializing and deserializing the newly added addrv2 netaddress timestamps uint64s to be more restrictive and reject any values that result in times that require special handling for comparisons. While here, it also does the same for int64 timestamps even though those cases are already handled otherwise. This clamping behavior is not strictly required since code that deals with the timestamps later is careful to avoid bad timestamps in general, but it safer to just reject them at the protocol level so even if code elsewhere is not taking extra precautions there would still not be any potential issues.
80bb930 to
af4aaac
Compare
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.
This modifies the code that deals with serializing and deserializing the newly added addrv2 netaddress timestamps uint64s to be more restrictive and reject any values that result in times that require special handling for comparisons. While here, it also does the same for
int64timestamps even though those cases are already handled otherwise.This clamping behavior is not strictly required since code that deals with the timestamps later is careful to avoid bad timestamps in general, but it safer to just reject them at the protocol level so even if code elsewhere is not taking extra precautions there still not be any potential issues.