nostrrelay/relay
padreug b74af2628e
Some checks failed
CI / lint (push) Has been cancelled
CI / tests (push) Has been cancelled
fix(nostrrelay): populate size field for event storage accounting
Changes:
- relay/event.py: Add `size: int = 0` field to NostrEvent model
- relay/client_connection.py: Set `event.size = event.size_bytes` when creating events from WebSocket messages

The size field has existed in the database schema since migration m001 but was never populated, causing:
  - Incorrect storage accounting (always 0)
  - Broken storage quota enforcement
  - Failed event pruning when storage limits reached

The size field is internal relay metadata and is excluded from the nostr_dict() output, maintaining NIP-01 compliance. The size_bytes property calculates the actual byte size of the event's JSON representation.

Fixes: Database constraint violation when inserting events without the required size column value.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 23:53:37 +01:00
..
__init__.py refactor: extract client_connection 2023-02-17 14:44:39 +02:00
client_connection.py fix(nostrrelay): populate size field for event storage accounting 2026-01-06 23:53:37 +01:00
client_manager.py chore: add uv, linting, fixes (#39) 2025-10-30 10:43:27 +01:00
event.py fix(nostrrelay): populate size field for event storage accounting 2026-01-06 23:53:37 +01:00
event_validator.py chore: add uv, linting, fixes (#39) 2025-10-30 10:43:27 +01:00
filter.py chore: add uv, linting, fixes (#39) 2025-10-30 10:43:27 +01:00
relay.py chore: add uv, linting, fixes (#39) 2025-10-30 10:43:27 +01:00