tests: wait for wallet pending state before equality
What changed, and why it matters
This commit only changes test code. It makes wallet equality tests wait for pending transactions to fully clear from the wallets' own state before comparing balances and rescanning spent outputs. There is no change to production wallet logic, no fix for a runtime security bug, and no user-facing behavior change.
No security action required. Treat as a normal test maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies two test files. In TestMoneroWalletFull.java, the test now calls waitForTxsToClearWallets instead of waitForTxsToClearPool before rescanning spent outputs. In WalletEqualityUtils.java, the shared on-chain equality helper also waits for pending transactions to clear from the wallets’ state rather than from the daemon’s transaction pool. The comments are updated accordingly. This is a test reliability improvement to avoid race conditions where pending change/balance state causes equality assertions to fail.
Changed components
src/test/java/TestMoneroWalletFull.javasrc/test/java/utils/WalletEqualityUtils.javaInspect captured patch +5 / −5
### src/test/java/TestMoneroWalletFull.java
@@ -857,8 +857,8 @@ public void testWalletsDoNotInterfere() {
@Test
public void testWalletEqualityRpc() {
- // wait for txs to clear pool
- TestUtils.WALLET_TX_TRACKER.waitForTxsToClearPool(TestUtils.getWalletRpc(), wallet);
+ // wait for pending txs to clear from wallets before rescanning spent outputs
+ TestUtils.WALLET_TX_TRACKER.waitForTxsToClearWallets(TestUtils.getWalletRpc(), wallet);
// TODO: rescanning spent outputs is necessary for equality test to mark as spent/unspent correctly
wallet.rescanSpent();
### src/test/java/utils/WalletEqualityUtils.java
@@ -43,7 +43,7 @@ public class WalletEqualityUtils {
*/
public static void testWalletEqualityOnChain(MoneroWallet w1, MoneroWallet w2) {
- // wait for relayed txs associated with wallets to clear pool
+ // wait for relayed txs to clear from both wallets
assertEquals(w1.isConnectedToDaemon(), w2.isConnectedToDaemon());
if (w1.isConnectedToDaemon()) {
@@ -55,8 +55,8 @@ public static void testWalletEqualityOnChain(MoneroWallet w1, MoneroWallet w2) {
w2.sync();
}
- // wait for txs to clear the pool
- TestUtils.WALLET_TX_TRACKER.waitForTxsToClearPool(w1, w2);
+ // wait for pending txs to clear from wallets so balances exclude pending change
+ TestUtils.WALLET_TX_TRACKER.waitForTxsToClearWallets(w1, w2);
}
// test that wallets are equal using only on-chain dataWhy this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.