Commit graph

20 commits

Author SHA1 Message Date
jakobsn
381cb94295 Commit alternative solution for pool inflation 2026-03-11 09:31:21 +00:00
Dagur Valberg Johannsson
f421327a5d
Switch to tokio and sqlx
This makes the application fully async; freeing web server threads to
handle new connections when waiting on SQL queries.

Additionally sqlx will allow easier move to a different database if
needed in the future.

Includes some SQL optimizations as well (slow queries more easliy identifiable
with sqlx).
2026-02-18 10:16:51 +01:00
Dagur Valberg Johannsson
ceb0e54dc0
Add 'bcmr' to metrics cache
This removes the need to have a BCMR connction during token search /
listing; also saving 2x lookups per token in results.
2026-02-17 14:06:16 +01:00
Dagur Valberg Johannsson
e1ebc853f5 Fix potential API hangs from write lock contention
- 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
2026-02-02 21:01:50 +01:00
Dagur Valberg Johannsson
beebc2c86f
bugfix: Reverse hash issues with blob 2026-02-02 11:34:18 +01:00
Dagur Valberg Johannsson
58fd9595d7
Convert hash columns from TEXT to BLOB storage
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
2026-01-22 08:30:17 +01:00
Dagur Valberg Johannsson
d85bc2c9db
Update copyright headers 2026-01-21 12:37:13 +01:00
Dagur Valberg Johannsson
ec20a2ad75 Add graceful shutdown for background threads
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.
2026-01-21 12:23:08 +01:00
Dagur Valberg Johannsson
a6c6159eba
Add Chipnet support 2026-01-09 13:46:58 +01:00
jakobsn
8fd14cc65b Manage several entries one txid 2025-11-17 09:21:51 +00:00
Dagur Valberg Johannsson
8be4cf894e
Add a volume index
Significantly improves cpu load of volume queries
2025-10-08 13:56:36 +02:00
jakobsn
885dde9534 Resolve "Panic occurred: attempt to multiply with overflow" 2025-10-03 13:32:37 +00:00
Jakob Notland
3b70e3e932 Format 2025-09-17 12:08:03 +02:00
Jakob Notland
af97a75540 Consider blockheight before timestamp 2025-09-17 12:05:24 +02:00
Jakob Notland
46462284e8 Clean 2025-09-17 11:52:22 +02:00
Jakob Notland
4d2336d9d7 clean 2025-09-17 11:27:05 +02:00
Jakob Notland
7e7f5b9bc7 Expose first pool created timestamp 2025-09-17 11:11:21 +02:00
jakobsn
6f25872ef7 Delete zero-tvl tokens from cached list. Allow zero-tvl search on exact tokenId 2025-09-16 09:10:54 +00:00
jakobsn
debe1630f4 Handleyoungtokenpricedifferences 2025-09-11 07:36:06 +00:00
jakobsn
f83f472656
Goodsearchandsort 2025-09-05 13:53:10 +00:00