test: update offline wallet expectations for ungated daemon calls
What changed, and why it matters
This commit only changes test code. It updates the expected behavior of an offline Monero wallet so that certain daemon-related calls no longer throw a 'not connected' error. The underlying wallet behavior was already changed elsewhere; this patch just makes the tests match it. There is no direct security fix here.
No action required for security. Review the upstream wallet2 change that caused these test expectation changes if you want to assess whether daemon error masking has security implications.
Security signals we found
Test-only change
Error message masking from untrusted daemons mentioned in comment
Behavior alignment with monero-wallet-rpc auto_refresh
Evidence from the diff
The commit modifies TestMoneroWalletFull.java to reflect new offline-wallet behavior: getDaemonHeight now surfaces wallet2’s generic ‘daemon error’ instead of a custom ‘Wallet is not connected to daemon’ message, and startSyncing now succeeds offline (matching monero-wallet-rpc’s auto_refresh behavior). These are test expectation updates, not runtime code changes.
Changed components
src/test/java/TestMoneroWalletFull.javaInspect captured patch +4 / −5
### src/test/java/TestMoneroWalletFull.java
@@ -251,8 +251,9 @@ public void testCreateWalletRandomFull() {
// cannot get daemon chain height
try {
wallet.getDaemonHeight();
+ fail("Should have thrown exception");
} catch (MoneroError e) {
- assertEquals("Wallet is not connected to daemon", e.getMessage());
+ assertEquals("daemon error", e.getMessage()); // wallet2 masks errors from untrusted daemons
}
// set daemon connection and check chain height
@@ -307,7 +308,7 @@ public void testCreateWalletFromSeedFull() {
assertFalse(wallet.isSynced());
assertEquals(1, wallet.getHeight());
assertEquals(0, wallet.getRestoreHeight());
- try { wallet.startSyncing(); } catch (MoneroError e) { assertEquals("Wallet is not connected to daemon", e.getMessage()); }
+ wallet.startSyncing(); // succeeds while offline, syncing when a daemon becomes reachable
wallet.close();
// create wallet without restore height
@@ -771,9 +772,7 @@ public void testStartStopSyncing() {
assertNotNull(wallet.getSeed());
assertEquals(1, wallet.getHeight());
assertEquals(BigInteger.valueOf(0), wallet.getBalance());
- wallet.startSyncing();
- } catch (MoneroError e) {
- assertEquals("Wallet is not connected to daemon", e.getMessage());
+ wallet.startSyncing(); // succeeds while offline, syncing when a daemon becomes reachable
} finally {
wallet.close();
}Why this scored 17/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.