From 4405d34f4b5f77a7ce46b8742fafb7fc13ce575d Mon Sep 17 00:00:00 2001 From: Sami Ahmed Date: Tue, 24 Mar 2026 17:24:47 -0700 Subject: [PATCH] Add Linux unit test CI job, TRY_LOCK for GUI, gitignore cleanup - Add test-linux-unit CI job; release now depends on tests passing - Replace LOCK(cs_wallet) with TRY_LOCK in transactiontablemodel to avoid GUI freezes - Add build artifacts to .gitignore (dist/, zips, object scripts) - Add unit test instructions to README Co-Authored-By: Claude Opus 4.6 --- .github/workflows/build-all.yml | 25 ++++++++++++++++++++++++- .gitignore | 6 ++++++ README.md | 5 +++++ src/qt/transactiontablemodel.cpp | 14 ++++++++++++-- 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index 0c78891..0582399 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -12,6 +12,29 @@ env: VERSION: "5.3.6" jobs: + test-linux-unit: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential libboost-all-dev \ + libssl-dev libdb++-dev libleveldb-dev libevent-dev libminiupnpc-dev + + - name: Build LevelDB + run: | + cd src/leveldb + chmod +x build_detect_platform + make clean || true + make OPT="-O2" libleveldb.a libmemenv.a + + - name: Run unit tests + run: | + cd src + make -f makefile.unix test -j$(nproc) + build-windows-qt: runs-on: windows-latest defaults: @@ -259,7 +282,7 @@ jobs: release: if: startsWith(github.ref, 'refs/tags/v') - needs: [build-windows-qt, build-windows-daemon, build-linux-qt, build-linux-daemon, build-macos] + needs: [test-linux-unit, build-windows-qt, build-windows-daemon, build-linux-qt, build-linux-daemon, build-macos] runs-on: ubuntu-latest permissions: contents: write diff --git a/.gitignore b/.gitignore index 5a6bca4..b85338e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,12 +5,18 @@ *.so *.dylib *.a +/dist/ build/ release/ debug/ +/Makefile Makefile.Debug Makefile.Release .qmake.stash +object_script.triangles-qt.Debug +object_script.triangles-qt.Release +/*.zip +/*.tar.gz # Qt moc_*.cpp diff --git a/README.md b/README.md index c4651e1..15c51b4 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,11 @@ make -j$(nproc) -f makefile.unix USE_UPNP=0 strip trianglesd ``` +Run the unit test suite: +```bash +make -C src -f makefile.unix test +``` + ### Linux (AlmaLinux 9 / RHEL 9) Install dependencies: diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 58819d4..07e6e7f 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -192,8 +192,12 @@ public: // simply re-use the cached status. if(rec->statusUpdateNeeded()) { + // Never block the GUI thread while the core is holding cs_wallet. + // If the lock is busy, keep showing the cached status and refresh + // it on a later paint/update cycle. + TRY_LOCK(wallet->cs_wallet, lockWallet); + if (lockWallet) { - LOCK(wallet->cs_wallet); std::map::iterator mi = wallet->mapWallet.find(rec->hash); if(mi != wallet->mapWallet.end()) @@ -212,8 +216,14 @@ public: QString describe(TransactionRecord *rec) { + // Transaction details are generated on demand from wallet/db state. + // If the wallet is busy, return a lightweight placeholder instead of + // freezing the UI until the lock becomes available. + TRY_LOCK(wallet->cs_wallet, lockWallet); + if (!lockWallet) + return parent->tr("Transaction details are temporarily unavailable while the wallet is busy."); + { - LOCK(wallet->cs_wallet); std::map::iterator mi = wallet->mapWallet.find(rec->hash); if(mi != wallet->mapWallet.end()) {