Skip to content

Commit

Permalink
[REFACTOR] inline maybeAddToRemoveAddOncePayloads() private function
Browse files Browse the repository at this point in the history
Now that there is only one user it can be inlined.
  • Loading branch information
julianknutsen committed Dec 3, 2019
1 parent 5a174d5 commit 1bd450b
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ private boolean addProtectedStorageEntry(ProtectedStorageEntry protectedStorageE

return true;
}

/**
* Updates a local RefreshOffer with TTL changes and broadcasts those changes to the network
*
Expand Down Expand Up @@ -717,7 +717,9 @@ public boolean remove(ProtectedStorageEntry protectedStorageEntry,
sequenceNumberMap.put(hashOfPayload, new MapValue(protectedStorageEntry.getSequenceNumber(), this.clock.millis()));
sequenceNumberMapStorage.queueUpForSave(SequenceNumberMap.clone(sequenceNumberMap), 300);

maybeAddToRemoveAddOncePayloads(protectedStoragePayload, hashOfPayload);
// Update that we have seen this AddOncePayload so the next time it is seen it fails verification
if (protectedStoragePayload instanceof AddOncePayload)
removedAddOncePayloads.add(hashOfPayload);

if (storedEntry != null) {
// Valid remove entry, do the remove and signal listeners
Expand Down Expand Up @@ -769,13 +771,6 @@ public void removeInvalidProtectedStorageEntry(ProtectedStorageEntry protectedSt
// source (network).
}

private void maybeAddToRemoveAddOncePayloads(ProtectedStoragePayload protectedStoragePayload,
ByteArray hashOfData) {
if (protectedStoragePayload instanceof AddOncePayload) {
removedAddOncePayloads.add(hashOfData);
}
}

public ProtectedStorageEntry getProtectedStorageEntry(ProtectedStoragePayload protectedStoragePayload,
KeyPair ownerStoragePubKey)
throws CryptoException {
Expand Down

0 comments on commit 1bd450b

Please sign in to comment.