Spend a channel hashcash stamp in one statement (closes #150) #163

Merged
clawbot merged 1 commits from issue-150-hashcash-spend-once into next 2026-10-20 20:31:27 +02:00
1 Commits
Author SHA1 Message Date
sneak bb7b7ea0d1 Spend a channel hashcash stamp in one statement (closes #150)
check / check (push) Canceled after 0s
checkChannelHashcash looked a stamp up with one statement and recorded
it with another, so concurrent requests carrying the same stamp could
all pass the lookup before any of them recorded it, and each message
was sent. RecordSpentHashcash now reports whether its INSERT OR IGNORE
added a row, and the message is refused when it did not. A single
statement is atomic in SQLite. IsHashcashSpent had no other caller and
is removed. A failed write of the stamp now refuses the message instead
of being logged and ignored.

Model: opus-5-5
2026-10-20 17:57:40 +00:00