Repository navigation
fix(event): keep a preset created_at in GenericEvent.update() (2.4.2) - #560
Merged
Merged
Conversation
added 3 commits
October 4, 2026 13:18
update() restamped created_at with the clock before computing the id, so callers that set created_at got an id for a different second, and NIP-59 randomised timestamps were replaced by the send time. NIP-01 derives the id from the event's own fields, so update() now only stamps the clock when created_at is unset (null or zero). Restamping on purpose is available through the new updateWithCurrentTime(). Fixes #559
- nostr-java (all modules): 2.4.1 → 2.4.2 (patch) [maven] Fixed: GenericEvent.update() overwrote a caller-set created_at, so ids could be computed for a different second (#559). Added: GenericEvent.updateWithCurrentTime(), and the Lyrebird mention in the MCP server how-to.
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.
Summary
GenericEvent.update()restampedcreated_atwith the clock before computing the id. A caller that setcreated_at, calledupdate()and signed got an id for a different second than the one it saw, so relays rejected the event asinvalid: bad event id. NIP-59 randomised timestamps were also replaced by the send time. NIP-01 derives the id from the event's own fields, so this alignsupdate()with the protocol.Closes #559
Type of change
fix- Bug fix (non-breaking)docs- Documentation onlychore- Build, CI, or tooling changesWhat changed?
GenericEvent.update()keeps acreated_atthat is already set and only stamps the clock when it is unset (null or 0).GenericEvent.updateWithCurrentTime()for deliberate restamping.GenericEventUpdateTest, including the NIP-01 id check suggested in the issue.Testing
mvn -q clean install -DskipITs(exit 0)mvn -q verifyhas one failure,NostrMcpServerStdioIT.aHostCanSeeWhichIdentitiesTheServerHolds. It also fails on the commit before this fix: the test expects an empty keystore but reads the local OS keychain, which holds an identity. Unrelated to this change.created_at,update(), waited 1.1s, signed with a realIdentity.created_atkept, id unchanged through signing, id equals the NIP-01 hash, Schnorr signature verifies.Checklist