<p>In <a href="https://github.com/bisq-network/bisq/blob/master/p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java">P2PDataStorage.java</a> there is a <a href="https://github.com/bisq-network/bisq/blob/master/p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java#L112">hash map</a> that should contain the up to date view of the data that gets gossiped across the network.</p>
<p>The keys to this map are <a href="https://github.com/bisq-network/bisq/blob/master/p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java#L374-L375">generated</a> from the hash of the <a href="https://github.com/bisq-network/bisq/blob/master/p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java#L842-L844">protobuf serialized</a> <code>ProtectedStoragePayload</code>.</p>
<p>Unfortunately using this hash as a key is not a good choice because it can differ for the same payload depending on how it gets serialized. Protobuf serialization is non-deterministic when it comes to [maps].(<a href="https://developers.google.com/protocol-buffers/docs/proto3#maps" rel="nofollow">https://developers.google.com/protocol-buffers/docs/proto3#maps</a>)</p>
<blockquote>
<p>Wire format ordering and map iteration ordering of map values is undefined, so you cannot rely on your map items being in a particular order.</p>
</blockquote>
<p>And many payloads contain maps via the <a href="https://github.com/bisq-network/bisq/blob/master/common/src/main/proto/pb.proto#L663">extra_data field</a>.</p>
<p>This leads to payloads which should be considered unique ending up in the map multiple times. For example I have witnessed OfferPayloads that have the same OfferId inserted multiple times due to differing hashes due to different ordering of the map entries.</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/issues/3367?email_source=notifications&email_token=AJFFTNQD7P5ND4QQCG72PN3QNJGLBA5CNFSM4I55W3J2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HP5TNFQ">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNUSB7C6CMRGM7TP7I3QNJGLBANCNFSM4I55W3JQ">mute the thread</a>.<img src="https://github.com/notifications/beacon/AJFFTNUSSG6MIPJZAUVJPK3QNJGLBA5CNFSM4I55W3J2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HP5TNFQ.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/issues/3367?email_source=notifications\u0026email_token=AJFFTNQD7P5ND4QQCG72PN3QNJGLBA5CNFSM4I55W3J2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HP5TNFQ",
"url": "https://github.com/bisq-network/bisq/issues/3367?email_source=notifications\u0026email_token=AJFFTNQD7P5ND4QQCG72PN3QNJGLBA5CNFSM4I55W3J2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HP5TNFQ",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>