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

<hr>

<p>In <a href="https://github.com/bisq-network/bisq/pull/4953#discussion_r544726267">core/src/main/java/bisq/core/account/sign/SignedWitnessService.java</a>:</p>
<pre style='color:#555'>> @@ -487,8 +509,18 @@ private boolean verifyDate(SignedWitness signedWitness, long childSignedWitnessD
     ///////////////////////////////////////////////////////////////////////////////////////////
 
     @VisibleForTesting
-    void addToMap(SignedWitness signedWitness) {
-        signedWitnessMap.putIfAbsent(signedWitness.getHashAsByteArray(), signedWitness);
+    public void addToMap(SignedWitness signedWitness) {
+        P2PDataStorage.ByteArray hash = signedWitness.getHashAsByteArray();
+        signedWitnessMap.putIfAbsent(hash, signedWitness);
+
+        // We remove the entry with that hash in case we have cached it, so at the next getSignedWitnessSet
+        // call we use the updated signedWitnessMap to re-fill our cache.
+        getSignedWitnessSetCache.remove(new P2PDataStorage.ByteArray(signedWitness.getAccountAgeWitnessHash()));
+
+        // Not sure if that is needed as well, tests did succeed in both cases, but seems to be more safe to remove
+        // potential entries with hash as well. A removed item in getSignedWitnessSetCache carries no risk, though a
+        // remaining item would.
+        getSignedWitnessSetCache.remove(hash);
</pre>
<p>I have not looked closely but I took it from the getSignedWitnessSet methods where <code>signedWitness.getHashAsByteArray()</code> got compared with <code>new P2PDataStorage.ByteArray(signedWitness.getAccountAgeWitnessHash())</code>. Have not looked deeper into the domain if those 2 data are the same actually. If so, yes that second remove is pointless.</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/4953#discussion_r544726267">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNUQVPCNH2RFNIYF7OLSVFHZDANCNFSM4U32MFNA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNXXTM5NJC6RHWPXXELSVFHZDA5CNFSM4U32MFNKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOEEEGDBI.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/4953#discussion_r544726267",
"url": "https://github.com/bisq-network/bisq/pull/4953#discussion_r544726267",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>