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
This commit is contained in:
C
2025-03-04 16:44:34 -03:00
committed by GitHub
parent d6336b2da8
commit f7d9a1b5db
29 changed files with 237 additions and 1004 deletions

View File

@@ -77,8 +77,6 @@ echo "Starting regtest mint"
# cargo run --bin regtest_mint &
export CDK_MINTD_CLN_RPC_PATH="$cdk_itests/cln/one/regtest/lightning-rpc";
export CDK_MINTD_URL="http://$cdk_itests_mint_addr:$cdk_itests_mint_port_0";
export CDK_MINTD_WORK_DIR="$cdk_itests";
export CDK_MINTD_LISTEN_HOST=$cdk_itests_mint_addr;
@@ -86,6 +84,7 @@ export CDK_MINTD_LISTEN_PORT=$cdk_itests_mint_port_0;
export CDK_MINTD_LN_BACKEND="cln";
export CDK_MINTD_MNEMONIC="eye survey guilt napkin crystal cup whisper salt luggage manage unveil loyal";
export CDK_MINTD_DATABASE=$MINT_DATABASE;
export RUST_BACKTRACE=1
echo "Starting cln mintd";
cargo run --bin cdk-mintd &