cashubtc / npubcash-server

MIT License
31 stars 4 forks source link

New Claim Model + Database cleaner #6

Closed Egge21M closed 6 months ago

Egge21M commented 7 months ago

This PR introduces two fundamental changes to the Claim schema:

  1. Claims are now mapped to a Transaction (Relational key constraint).
  2. Claims now only hold a single Proof. If a Transaction includes multiple proofs, multiple claims will be created

The reason for this change is, that it makes it a lot easier to keep the database clean. This PR also includes logic to regularly (when user check their balance) check if tokens currently marked as "ready" are still unspent and updates their status if they are not. Claim route and balance route also no longer select ALL proofs but only those with status as "ready"