<p><b>@chimp1984</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/bisq-network/bisq/pull/3556#discussion_r342351874">p2p/src/main/java/bisq/network/p2p/P2PService.java</a>:</p>
<pre style='color:#555'>> @@ -704,8 +704,14 @@ public void onBroadcastFailed(String errorMessage) {
                         // The p2PDataStorage.remove makes probably sense but need to be analysed more.
                         // Don't change that if it is not 100% clear.
                         sendMailboxMessageListener.onFault("Data already exists in our local database");
-                        boolean removeResult = p2PDataStorage.remove(protectedMailboxStorageEntry, networkNode.getNodeAddress(), true);
-                        log.debug("remove result=" + removeResult);
+
+                        // Generate a new entry so sequence number is larger than previous add()
+                        ProtectedMailboxStorageEntry removeProtectedMailboxStorageEntry = p2PDataStorage.getMailboxDataWithSignedSeqNr(
+                                expirableMailboxStoragePayload,
+                                keyRing.getSignatureKeyPair(),
+                                receiversPublicKey);
+                        boolean removeResult = p2PDataStorage.removeMailboxData(removeProtectedMailboxStorageEntry, networkNode.getNodeAddress(), true);
+                        log.error("Unexpected state: adding mailbox message that already exists. removeMailboxData result=" + removeResult);
                     }
</pre>
<p>If the result from addProtectedStorageEntry is false we have not added data to the map or the sequence nr map. From my understanding I think the remove is pointless as there is nothing to remove anyway in case of a failed add. But maybe I am missing something. Do you see any case where this would make sense? Beside that your code looks correct to me. So if you agree that the whole result=false path is pointless, I would suggest to remove it instead.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/3556?email_source=notifications&email_token=AJFFTNSHM2AYNVERQLQIG5DQSDGI5A5CNFSM4JIYAKSKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCKII3CY#pullrequestreview-311463307">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNQJPF2PB3BONFZD7FDQSDGI5ANCNFSM4JIYAKSA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNUBMOUUQDACV6BA2LDQSDGI5A5CNFSM4JIYAKSKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCKII3CY.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/3556?email_source=notifications\u0026email_token=AJFFTNSHM2AYNVERQLQIG5DQSDGI5A5CNFSM4JIYAKSKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCKII3CY#pullrequestreview-311463307",
"url": "https://github.com/bisq-network/bisq/pull/3556?email_source=notifications\u0026email_token=AJFFTNSHM2AYNVERQLQIG5DQSDGI5A5CNFSM4JIYAKSKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCKII3CY#pullrequestreview-311463307",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>