test(litebe): make the retire test deterministic under the change-gate
The change-gated refresh worker only runs `balance` on a full-refresh cycle, so testLiteWalletControllerRetire could no longer reliably park the worker inside a blocked `balance` (it passed only by timing). Bump the fake scanned height to force a full-refresh cycle, which enters the now-blocked `balance` deterministically. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -12139,6 +12139,9 @@ void testLiteWalletControllerRetire()
|
|||||||
EXPECT_TRUE(c->importKeyAsync("secret-extended-key-x", [&](const LiteImportResult& r) { ++n2; ok2 = r.ok; }));
|
EXPECT_TRUE(c->importKeyAsync("secret-extended-key-x", [&](const LiteImportResult& r) { ++n2; ok2 = r.ok; }));
|
||||||
const long entered = dragonx::test::g_liteFakeBalanceEntered.load();
|
const long entered = dragonx::test::g_liteFakeBalanceEntered.load();
|
||||||
dragonx::test::g_liteFakeBlockBalance = true;
|
dragonx::test::g_liteFakeBlockBalance = true;
|
||||||
|
// The refresh worker change-gates (C23): it only runs `balance` on a full-refresh cycle. Bump the
|
||||||
|
// scanned height so the gate forces a DoFull, which enters the now-blocked `balance` and parks there.
|
||||||
|
dragonx::test::g_liteFakeHeight = dragonx::test::g_liteFakeHeight.load() + 1;
|
||||||
for (int i = 0; i < 1000 && dragonx::test::g_liteFakeBalanceEntered.load() == entered; ++i)
|
for (int i = 0; i < 1000 && dragonx::test::g_liteFakeBalanceEntered.load() == entered; ++i)
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||||
EXPECT_TRUE(dragonx::test::g_liteFakeBalanceEntered.load() > entered);
|
EXPECT_TRUE(dragonx::test::g_liteFakeBalanceEntered.load() > entered);
|
||||||
|
|||||||
Reference in New Issue
Block a user