Skip to content

Commit

Permalink
[DEAD CODE] Remove getProtectedDataStoreMap
Browse files Browse the repository at this point in the history
The only user has been migrated to getMap(). Delete it so future
development doesn't have the same 20-byte vs 32-byte key issue.
  • Loading branch information
julianknutsen committed Nov 19, 2019
1 parent 02cc6c1 commit 1e648a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,6 @@ public Map<ByteArray, PersistableNetworkPayload> getAppendOnlyDataStoreMap() {
return appendOnlyDataStoreService.getMap();
}

public Map<P2PDataStorage.ByteArray, ProtectedStorageEntry> getProtectedDataStoreMap() {
return protectedDataStoreService.getMap();
}


///////////////////////////////////////////////////////////////////////////////////////////
// MessageListener implementation
///////////////////////////////////////////////////////////////////////////////////////////
Expand Down
10 changes: 5 additions & 5 deletions p2p/src/test/java/bisq/network/p2p/storage/TestState.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ void verifyProtectedStorageAdd(SavedTestState beforeState,
// TODO: Should the behavior be identical between this and the HashMap listeners?
// TODO: Do we want ot overwrite stale values in order to persist updated sequence numbers and timestamps?
if (protectedStorageEntry.getProtectedStoragePayload() instanceof PersistablePayload && beforeState.protectedStorageEntryBeforeOpDataStoreMap == null) {
Assert.assertEquals(protectedStorageEntry, this.mockedStorage.getProtectedDataStoreMap().get(storageHash));
Assert.assertEquals(protectedStorageEntry, this.protectedDataStoreService.getMap().get(storageHash));
verify(this.protectedDataStoreListener).onAdded(protectedStorageEntry);
} else {
Assert.assertEquals(beforeState.protectedStorageEntryBeforeOpDataStoreMap, this.mockedStorage.getProtectedDataStoreMap().get(storageHash));
Assert.assertEquals(beforeState.protectedStorageEntryBeforeOpDataStoreMap, this.protectedDataStoreService.getMap().get(storageHash));
verify(this.protectedDataStoreListener, never()).onAdded(protectedStorageEntry);
}

Expand All @@ -245,7 +245,7 @@ void verifyProtectedStorageAdd(SavedTestState beforeState,
this.verifySequenceNumberMapWriteContains(P2PDataStorage.get32ByteHashAsByteArray(protectedStorageEntry.getProtectedStoragePayload()), protectedStorageEntry.getSequenceNumber());
} else {
Assert.assertEquals(beforeState.protectedStorageEntryBeforeOp, this.mockedStorage.getMap().get(hashMapHash));
Assert.assertEquals(beforeState.protectedStorageEntryBeforeOpDataStoreMap, this.mockedStorage.getProtectedDataStoreMap().get(storageHash));
Assert.assertEquals(beforeState.protectedStorageEntryBeforeOpDataStoreMap, this.protectedDataStoreService.getMap().get(storageHash));

verify(this.mockBroadcaster, never()).broadcast(any(BroadcastMessage.class), any(NodeAddress.class), any(BroadcastHandler.Listener.class), anyBoolean());

Expand Down Expand Up @@ -300,7 +300,7 @@ void verifyProtectedStorageRemove(SavedTestState beforeState,
Assert.assertNull(this.mockedStorage.getMap().get(hashMapHash));

if (protectedStorageEntry.getProtectedStoragePayload() instanceof PersistablePayload) {
Assert.assertNull(this.mockedStorage.getProtectedDataStoreMap().get(storageHash));
Assert.assertNull(this.protectedDataStoreService.getMap().get(storageHash));

verify(this.protectedDataStoreListener).onRemoved(protectedStorageEntry);
}
Expand Down Expand Up @@ -421,7 +421,7 @@ private SavedTestState(TestState testState, ProtectedStorageEntry protectedStora
this(testState);

P2PDataStorage.ByteArray storageHash = P2PDataStorage.getCompactHashAsByteArray(protectedStorageEntry.getProtectedStoragePayload());
this.protectedStorageEntryBeforeOpDataStoreMap = testState.mockedStorage.getProtectedDataStoreMap().get(storageHash);
this.protectedStorageEntryBeforeOpDataStoreMap = testState.protectedDataStoreService.getMap().get(storageHash);

P2PDataStorage.ByteArray hashMapHash = P2PDataStorage.get32ByteHashAsByteArray(protectedStorageEntry.getProtectedStoragePayload());
this.protectedStorageEntryBeforeOp = testState.mockedStorage.getMap().get(hashMapHash);
Expand Down

0 comments on commit 1e648a7

Please sign in to comment.