Add proper error handling and logging for add_mint operation instead of
propagating errors, preventing wallet operations from failing completely
when a mint cannot be added.
- write generated migration files to OUT_DIR instead of source directory
- copy migration SQL files to OUT_DIR for inclusion in build artifacts
- use absolute paths from OUT_DIR in include_str! macros
- update consumer modules to include from OUT_DIR using concat! macro
these changes enable cdk to support nix sandbox builds
* feat(cdk): add amount_mintable method and improve mint quote validation
- Add MintQuote::amount_mintable() method to calculate available mint amount
- Update mint issue logic to use centralized amount calculation
- Add validation for Bolt11 payment amounts matching quote amounts
- Improve error handling and logging for quote amount mismatches
* Add `resolve_dns_txt` to HttpTransport and MintConnector
Fixes#1036
* Use `hickory_resolver` to resolve DNS entries
* Remote default implementation of methods
* Fix build for wasm
* Add consistent ordering of sql migrations
Also sort the prefix and not only the filenames
* Reorganize tests, add mint quote/payment coverage, and prevent over-issuing
Reorganizes the mint test suite into clear modules, adds comprehensive mint
quote & payment scenarios, enhances the shared test macro, and hardens SQL
logic to forbid issuing more than what’s been paid.
These tests were added:
* Add quote once; reject duplicates.
* Register multiple payments and verify aggregated amount_paid.
* Read parity between DB and in-TX views.
* Reject duplicate payment_id in same and different transactions.
* Reject over-issuing (same TX, different TX, with/without prior payments).
---------
Co-authored-by: thesimplekid <tsk@thesimplekid.com>
There was a race conditions between the database storing the mint quote and the
fake wallet paying the invoice of a yet not existing mint quote
Add a delay of seconds before paying all invoices
To recreate the slow conditions that would make our database slower than the
external Fakewallet in Linux
```
sudo tc qdisc add dev lo root netem delay 200ms 50ms
ionice -c3 nix develop -i -L .#stable --command just itest-payment-processor FAKEWALLET
```
To reset
```
sudo tc qdisc del dev lo root
```
- Add quote_id field to Transaction struct in cdk-common
- Add database migrations for quote_id column in SQLite and PostgreSQL
- Update wallet operations to populate quote_id for mint/melt transactions
- Set quote_id to None for send/receive operations without associated quotes
* Fix migrations ordering
1. Fix postgres migration prefixes for unreleased migrations
2. Fix build script to try to sort, if provided, the filename prefix as a
number, otherwise fallback to the sorting by filename as string
* Fixed clippy issues
* feat(cdk): add generic key-value store functionality for mint databases
Implements a comprehensive KV store system with transaction support,
namespace-based organization, and validation for mint databases.
- Add KVStoreDatabase and KVStoreTransaction traits for generic storage
- Include namespace and key validation with ASCII character restrictions
- Add database migrations for kv_store table in SQLite and PostgreSQL
- Implement comprehensive test suite for KV store functionality
- Integrate KV store traits into existing Database and Transaction bounds