mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Reapply original code from @jmacxx in AddressEntryList
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
parent
b11511e037
commit
4262e91f1f
@ -209,11 +209,26 @@ public final class AddressEntryList implements PersistableEnvelope, PersistedDat
|
||||
}
|
||||
|
||||
log.info("swapToAvailable addressEntry to swap={}", addressEntry);
|
||||
boolean setChangedByRemove = entrySet.remove(addressEntry);
|
||||
boolean setChangedByAdd = entrySet.add(new AddressEntry(addressEntry.getKeyPair(),
|
||||
AddressEntry.Context.AVAILABLE,
|
||||
addressEntry.isSegwit()));
|
||||
if (setChangedByRemove || setChangedByAdd) {
|
||||
if (entrySet.remove(addressEntry)) {
|
||||
requestPersistence();
|
||||
}
|
||||
// If we have an address entry which shared the address with another one (shared maker fee offers use case)
|
||||
// then we do not swap to available as we need to protect the address of the remaining entry.
|
||||
boolean entryWithSameContextStillExists = entrySet.stream().anyMatch(entry -> {
|
||||
if (addressEntry.getAddressString() != null) {
|
||||
return addressEntry.getAddressString().equals(entry.getAddressString()) &&
|
||||
addressEntry.getContext() == entry.getContext();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (entryWithSameContextStillExists) {
|
||||
return;
|
||||
}
|
||||
// no other uses of the address context remain, so make it available
|
||||
if (entrySet.add(
|
||||
new AddressEntry(addressEntry.getKeyPair(),
|
||||
AddressEntry.Context.AVAILABLE,
|
||||
addressEntry.isSegwit()))) {
|
||||
requestPersistence();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user