Skip to main content

Module wrappers

Module wrappers 

Source
Expand description

Wrapper tracking — NIP-59 gift wrap dedup + NIP-77 negentropy.

Constants§

TRANSPORT_CONCORD
TRANSPORT_NIP17
Transport carriers for the shared outer-event ledger — stored as a small INTEGER discriminator (cheaper than a per-row string, and the ledger can grow large). Never renumber an existing value.

Functions§

load_negentropy_items
Load all processed wrappers as (EventId, Timestamp) pairs for negentropy (NIP-77).
load_processed_wrappers
Load all processed wrapper IDs as raw bytes for the dedup cache.
load_processed_wrappers_since
load_processed_wrappers bounded to wrapper_created_at >= since_secs — the dedup cache only needs the window the planned reconciles can touch; anything older that still arrives dedups through the DB fallback.
load_recent_wrapper_ids
Load recent wrapper IDs from events table (last N days) as raw bytes.
processed_wrapper_exists
Sync existence check against the ledger (any transport) — the DB half of the outer-event dedup for callers that can’t reach the async WRAPPER_ID_CACHE (e.g. the synchronous Concord ingest). Returns false on a missing/closed DB so a dedup failure never drops a genuinely-new event.
save_processed_wrapper
Persist an outer-event id for cross-session dedup (INSERT OR IGNORE), tagged by transport so the ledger is shared across transports while negentropy stays NIP-17-scoped.
update_wrapper_timestamp
Backfill a wrapper timestamp onto an EXISTING ledger row (pre-migration-17 rows hold 0). UPDATE-only by design: the ledger is the negentropy fingerprint set, and message wrappers may be deferred (batch-buffered) — an INSERT here could ledger a message before its row lands, marking it “have” forever. Inserting belongs to the save paths, never this backfill.