mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-25 07:27:18 +01:00
Add check to not add a duplicate address entry with same offer ID and context.
In debugging trade protocol and taking same offer I could generate problems where the multisig entry was twice but with diff. keys, so take offer failed. I remember the error log to have seen in the past and I assume this was a rare bug we encountered when users took again the same offer which failed with an uncritical state earlier.
This commit is contained in:
parent
2bb4bff41d
commit
766b1e2e1e
1 changed files with 17 additions and 5 deletions
|
@ -173,6 +173,18 @@ public final class AddressEntryList implements UserThreadMappedPersistableEnvelo
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addAddressEntry(AddressEntry addressEntry) {
|
public void addAddressEntry(AddressEntry addressEntry) {
|
||||||
|
boolean entryWithSameOfferIdAndContextAlreadyExist = entrySet.stream().anyMatch(e -> {
|
||||||
|
if (addressEntry.getOfferId() != null) {
|
||||||
|
return addressEntry.getOfferId().equals(e.getOfferId()) && addressEntry.getContext() == e.getContext();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
if (entryWithSameOfferIdAndContextAlreadyExist) {
|
||||||
|
log.error("We have an address entry with the same offer ID and context. We do not add the new one. " +
|
||||||
|
"addressEntry={}, entrySet={}", addressEntry, entrySet);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean setChangedByAdd = entrySet.add(addressEntry);
|
boolean setChangedByAdd = entrySet.add(addressEntry);
|
||||||
if (setChangedByAdd)
|
if (setChangedByAdd)
|
||||||
persist();
|
persist();
|
||||||
|
|
Loading…
Add table
Reference in a new issue