Commit Graph

25 Commits

Author SHA1 Message Date
C
f7d9a1b5db Drop the in-memory database (#613)
* Drop the in-memory database

Fixes #607

This PR drops the implementation of in-memory database traits.

They are useful for testing purposes since the tests should test our codebase
and assume the database works as expected (although a follow-up PR should write
a sanity test suite for all database trait implementors).

As complexity is worth with database requirements to simplify complexity and
add more robustness, for instance, with the following plans to add support for
transactions or buffered writes, it would become more complex and
time-consuming to support a correct database trait. This PR drops the
implementation and replaces it with a SQLite memory instance

* Remove OnceCell<Mint>

Without this change, a single Mint is shared for all tests, and the first tests
to run and shutdown makes the other databases (not-reachable, as dropping the
tokio engine would also drop the database instance).

There is no real reason, other than perhaps performance. The mint should
perhaps run in their own tokio engine and share channels as API interfaces, or
a new instance should be created in each tests

* Fixed bug with foreign keys

[1] https://gist.github.com/crodas/bad00997c63bd5ac58db3c5bd90747ed

* Show more debug on failure

* Remove old code

* Remove old references to WalletMemoryDatabase
2025-03-04 19:44:34 +00:00
thesimplekid
827e4aebde Refactor mintd used in itest (#616) 2025-02-25 11:47:17 +00:00
thesimplekid
a8ec52612b Refactor mint tranactions checks (#585)
* refactor: consolidate validation checks

* refactor: melt verification checks

* refactor: mint verification

* chore: clippy

* chore: use error codes

* fix: order of verifications

* fix: p2pk test ws updates

We only expect the proof to be set to pending once. As a proof without
a signature failes before the spent check where the state is chaged.

* fix: mint_melt regtest frome wait
2025-02-08 11:17:44 +00:00
lollerfirst
f2e1940cc7 [NUT-15] LND Support for MPP Payments (#536)
---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-02-06 09:30:48 +00:00
thesimplekid
0adf4e210d fix: cache test mint 2025-02-04 16:40:11 +00:00
thesimplekid
0c6108f86d fix: add time out to wait invoice in tests 2025-01-28 17:15:04 +00:00
thesimplekid
70daaec622 fix: tests that attempt to mint before payment 2025-01-28 14:12:27 +00:00
thesimplekid
67be74abb8 feat: tests on lnd node 2025-01-24 14:55:02 +00:00
thesimplekid
486f98bc8b feat: lnd mint 2025-01-23 23:45:31 +00:00
thesimplekid
72c66af8b7 feat: second lnd node 2025-01-23 20:56:01 +00:00
thesimplekid
a9662d0362 refactor: add second cln node 2025-01-20 21:07:21 +00:00
thesimplekid
6a8a5a7941 fix: mpp (#523) 2025-01-05 14:42:44 +00:00
David Caseria
d6b7d49ea9 Return proofs for wallet mint function (#520)
* chore: update flake

---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-01-03 13:23:52 +00:00
thesimplekid
003a8f1b47 feat: signature on mint witness 2024-12-23 10:25:42 -05:00
thesimplekid
b9df44b10a chore: update regtest-rs 2024-12-10 14:12:03 +00:00
Cesar Rodas
760564cee0 Introduce subscription support in the Wallet crate.
The main goal is to add a subscription to CDK Mint updates into the wallet.
This feature will be particularly useful for improving the code whenever loops
hit the mint server to check status changes.

The goal is to add an easy-to-use interface that will hide the fact that we're
connecting to WebSocket and subscribing to events. This will also hide the fact
that the CDK-mint server may not support WebSocket updates.

To be fully backward compatible, the HttpClientMethods traits have a new
method, `subscribe,` which will return an object that implements
`ActiveSubscription.`

In the primary implementation, there is a `SubscriptionClient` that will
attempt to connect through WebSocket and will fall to the HTTP-status pull and
sleep approach (the current approach), but upper stream code will receive
updates as if they come from a stream of updates through WebSocket. This
`SubscriptionClient` struct will also manage reconnections to WebSockets (with
automatic resubscriptions) and all the low-level stuff, providing an
easy-to-use interface and leaving the upper-level code with a nice interface
that is hard to misuse. When `ActiveSubscription` is dropped, it will
automatically unsubscribe.

Fixed bug with Default as described in https://github.com/cashubtc/cdk/pull/473#discussion_r1871032297
2024-12-08 16:25:00 +00:00
ok300
86c4c2dfeb Add support for pure integration tests (#458)
* Embed mint_url as a field of HttpClient

* Create pure integration tests

* DirectMintConnection: convert between String and Uuid
2024-12-08 14:33:58 +00:00
Timothée Delabrouille
7d87c4806c feat: use Uuid as mint and melt quote ids (#469) 2024-12-05 09:58:53 +00:00
thesimplekid
6dd023a71c chore: cargo fmt 2024-11-15 19:38:59 +00:00
César D. Rodas
cc5b267367 fix: Send current state of the subscriptions (#444) 2024-11-10 12:08:44 +00:00
César D. Rodas
6973e53799 Mint Websockets (NUT-17) (#394)
---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2024-11-06 14:36:13 +00:00
David Caseria
7eb3449710 Abstract HttpClient into HttpClientMethods trait (#429)
* Abstract HttpClientMethods trait
---------

Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2024-11-04 19:14:40 +00:00
ok300
20033ce94b Consolidate Wallet::get_proofs variants 2024-10-28 19:40:36 +00:00
lollerfirst
c25bf79e8c Cache SwapResponse, MeltBolt11Response and MintBolt11Response (#361)
* added cache to mint state and post request wrapper macro.
---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2024-10-05 11:18:23 +02:00
thesimplekid
f9bb5eb913 feat: itests
fix: melt change promises amount
2024-09-19 11:43:43 +02:00