What changed, and why it matters
This commit only changes a test file. It rewrites one wallet test so that it uses a separate offline wallet instead of importing outputs back into the same wallet. There is no change to production code and no security fix or vulnerability is visible in the diff.
No security action needed. Treat as routine test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies TestMoneroWalletCommon.java’s testGetNewKeyImagesFromLastImport(). The old test exported outputs from the current wallet and re-imported them into the same wallet, which produced no new key images. The new test exports all outputs with exportOutputs(true), creates a fresh offline wallet configured with the same keys and an offline server URI, imports the outputs there, and asserts that new key images are generated. This is purely a test-isolation/refactoring change.
Changed components
src/test/java/TestMoneroWalletCommon.javaInspect captured patch +16 / −15
### src/test/java/TestMoneroWalletCommon.java
@@ -2430,21 +2430,22 @@ public void testExportKeyImages() {
public void testGetNewKeyImagesFromLastImport() {
assumeTrue(TEST_NON_RELAYS);
- // get outputs hex
- String outputsHex = wallet.exportOutputs();
-
- // import outputs hex
- if (outputsHex != null) {
- int numImported = wallet.importOutputs(outputsHex);
- assertTrue(numImported >= 0);
- }
-
- // get and test new key images from last import
- List<MoneroKeyImage> images = wallet.getNewKeyImagesFromLastImport();
- if (images.isEmpty()) fail("No new key images in last import"); // TODO: these are already known to the wallet, so no new key images will be imported
- for (MoneroKeyImage image : images) {
- assertTrue(image.getHex().length() > 0);
- assertTrue(image.getSignature().length() > 0);
+ // export all outputs for a fresh offline wallet
+ String outputsHex = wallet.exportOutputs(true);
+ MoneroWallet offlineWallet = createWallet(new MoneroWalletConfig().setPrimaryAddress(wallet.getPrimaryAddress()).setPrivateViewKey(wallet.getPrivateViewKey()).setPrivateSpendKey(wallet.getPrivateSpendKey()).setServerUri(TestUtils.OFFLINE_SERVER_URI).setRestoreHeight(0l));
+ try {
+ int numImported = offlineWallet.importOutputs(outputsHex);
+ assertTrue(numImported > 0, "No outputs imported");
+
+ // get and test new key images from last import
+ List<MoneroKeyImage> images = offlineWallet.getNewKeyImagesFromLastImport();
+ if (images.isEmpty()) fail("No new key images in last import");
+ for (MoneroKeyImage image : images) {
+ assertTrue(image.getHex().length() > 0);
+ assertTrue(image.getSignature().length() > 0);
+ }
+ } finally {
+ closeWallet(offlineWallet);
}
}
Why 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.