Skip to content

Commit

Permalink
[PR COMMENTS] Use "Client API" in transient comments
Browse files Browse the repository at this point in the history
Fixup comments to better describe the set of API users that call
addProtectedStroageEntry(getProtectedStorageEntry) in contrast to the
onMessage handler users and GetData users.
  • Loading branch information
julianknutsen committed Nov 6, 2019
1 parent ae191c8 commit ce2ebeb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,9 @@ public boolean addProtectedStorageEntry(ProtectedStorageEntry protectedStorageEn
boolean hasSequenceNrIncreased = hasSequenceNrIncreased(protectedStorageEntry.getSequenceNumber(), hashOfPayload);

// If we have seen a more recent operation for this payload, we ignore the current one
// TODO: I think we can return false here. All callers use the get() public API which increments the sequence number
// leaving only the onMessage() handler which doesn't look at the return value. It makes more intuitive sense that adds() that don't
// change state return false.
// TODO: I think we can return false here. All callers use the Client API (addProtectedStorageEntry(getProtectedStorageEntry())
// leaving only the onMessage() handler which doesn't look at the return value. It makes more intuitive sense that adds() that don't
// change state return false.
if (!hasSequenceNrIncreased)
return true;

Expand Down Expand Up @@ -457,9 +457,9 @@ public boolean refreshTTL(RefreshOfferMessage refreshTTLMessage,
int sequenceNumber = refreshTTLMessage.getSequenceNumber();

// If we have seen a more recent operation for this payload, we ignore the current one
// TODO: I think we can return false here. All callers use the get() public API which increments the sequence number
// leaving only the onMessage() handler which doesn't look at the return value. It makes more intuitive sense that operations that don't
// change state return false.
// TODO: I think we can return false here. All callers use the Client API (refreshTTL(getRefreshTTLMessage()) which increments the sequence number
// leaving only the onMessage() handler which doesn't look at the return value. It makes more intuitive sense that operations that don't
// change state return false.
if (sequenceNumberMap.containsKey(hashOfPayload) && sequenceNumberMap.get(hashOfPayload).sequenceNr == sequenceNumber) {
log.trace("We got that message with that seq nr already from another peer. We ignore that message.");

Expand Down

0 comments on commit ce2ebeb

Please sign in to comment.