- Refactor update_changes_score_volume_and_ranking to use read connections
for read/compute phases, only acquiring write connection for final writes
- Change first_pool_creation to use try_get() for opportunistic caching,
preventing thread exhaustion if write pool is busy
- Add linter to flag blocking _w.get() calls in RPC handlers
Migrate all 32-byte hash fields from TEXT (64-char hex) to BLOB
(32 bytes) for ~50% storage savings on hash columns.
Changes:
- Add src/db/blob.rs with ToBlob/FromBlob traits for hash types
- Update all table schemas to use BLOB for hash columns
- Replace .to_hex() with .to_blob() for DB inserts
- Replace ::from_hex() with ::from_blob() for DB reads
- Use SQL hex() function where API responses need hex strings
- Bump DB_VERSION from 4 to 5
Affected tables: tx, pool, pool_history_entry, utxo_spending,
utxo_funding, user_action, auth_chain_entry, bcmr_data,
bcmr_failure, bcmr_well_known, crc20, crc20_candidates,
delphi_entry, cached_token_metrics
Fixes#1
Interpolate sqrt(K) linearly when the API's period_start is after the
pool's snapshot timestamp. This ensures yield and duration are calculated
over the same effective period, preventing overflow from high yields
being annualized over short durations.
Added unit tests based on failing production data for token d03a0d87...
Fixes#18
When a token has both an auth_chain_entry (without BCMR) and a CRC20
entry (with name/symbol), the dedup logic now keeps the metadata
instead of returning NULL.
Introduce a shutdown flag and Rocket fairing that signals background
threads to exit cleanly when Ctrl+C is pressed. Affects the indexing
thread, metrics updater, and block receiver loop.
Introduce CachedJson response wrapper with cache duration based on data mutability:
- CACHE_IMMUTABLE (1 day): historical data with explicit timestamps
- CACHE_BCMR (5 min): token metadata
- CACHE_AGGREGATE (60s): aggregate data that changes with blocks
- CACHE_NONE: real-time data (current price, active pools, latest txs)
Endpoints dynamically select cache duration based on whether time parameters
are explicitly provided (historical/immutable) or defaulted to now (live).
Remove errant UNIQUE INDEX on (utxo, txid) that conflicted with the
PRIMARY KEY (token_id, utxo, txid). A single transaction can update
auth chains for multiple tokens, requiring the same (utxo, txid) pair
to exist with different token_ids. The unique index blocked this.
The index was also unnecessary - EXPLAIN QUERY PLAN shows the PRIMARY
KEY index is used for all bcmr_failure lookups.
Add test covering multi-token failure recording.
Return proper 4XX status codes for client errors to prevent load balancers
from misinterpreting input validation failures as server errors. Add
centralized ApiResult type and ApiErrorCode enum for consistent handling.