<feed xmlns='http://www.w3.org/2005/Atom'>
<title>coinosv3-server.git/names/store.js, branch master</title>
<subtitle>coinos v3 server — payment-name registrar, NWC push, Blossom sync storage, feed</subtitle>
<id>https://git.coinos.io/coinosv3-server.git/atom?h=master</id>
<link rel='self' href='https://git.coinos.io/coinosv3-server.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.coinos.io/coinosv3-server.git/'/>
<updated>2026-10-16T19:57:19Z</updated>
<entry>
<title>names: keep state in SQLite</title>
<updated>2026-10-16T19:57:19Z</updated>
<author>
<name>Adam Soltys</name>
<email>asoltys@gmail.com</email>
</author>
<published>2026-10-16T19:57:19Z</published>
<link rel='alternate' type='text/html' href='https://git.coinos.io/coinosv3-server.git/commit/?id=a3d2dc2e05a4f7c5ab0d6e7689498da9ca63de7b'/>
<id>urn:sha1:a3d2dc2e05a4f7c5ab0d6e7689498da9ca63de7b</id>
<content type='text'>
persist() rewrote the whole state file, close to 10 MB, on every settled
payment and every queue tick, so one crash during a write could take every
name with it. State now lives in SQLite (bun:sqlite, WAL,
synchronous=FULL): one row per name, offer, invoice and so on, with the
forwarder wallet's state kept as a single row. Each persist() is one
transaction that writes only the rows that changed, so a crash leaves the
previous state or the new one, never a torn file.

The in-memory state object and every persist() call stay as they were. On
the first start the JSON state file is imported, and a corrupt one stops
startup. The file is left in place, so a rollback to the JSON build still
finds its data. store.snapshot() makes a consistent copy while the service
runs, for backups.

Co-Authored-By: Claude Opus 5.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
</feed>
