Files
amethyst/commons
Claude 6c7e4fd0dc feat(pow): keep created_at current while mining
NIP-13: "It is recommended to update the created_at as well during this
process." We only did half of it -- PoWPublishQueue and the anonymous post
paths re-stamped the timestamp when a worker picked the job up, but the
mining run itself was frozen. At 28 bits that is about a minute and at 30
several, so a post could still land in the feed minutes in the past.

PoWMiner.run/mine take an optional refreshCreatedAt clock. A search pass
now ends on either nonce-space exhaustion or a one-second budget (matching
created_at's resolution), and each new pass re-stamps from the clock and
rebuilds the payload. The returned template carries the timestamp its nonce
actually commits to. Restamps are clamped with maxOf(previous, now) so a
wall clock stepping back cannot drag a post into the past, and a pass that
stopped on the clock does not widen the nonce -- its space is untouched, it
just gets searched under the next timestamp.

Left frozen wherever created_at is meaningful: scheduled posts (the queue
reuses the existing predicate, renamed refreshCreatedAtOnStart ->
refreshCreatedAt now that it covers the whole run), NIP-59 gift wraps with
deliberately randomized timestamps, and amy pow, which mines a template the
caller supplied. Replaceable and ephemeral kinds never reach the miner.

Trailing-lambda call sites became explicit isActive = { ... } so the new
optional parameter cannot capture them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017pEArg58zWxDJ7EzzzPdXT
2026-08-13 13:41:23 +00:00
..