mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +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);
|
log.info("swapToAvailable addressEntry to swap={}", addressEntry);
|
||||||
boolean setChangedByRemove = entrySet.remove(addressEntry);
|
if (entrySet.remove(addressEntry)) {
|
||||||
boolean setChangedByAdd = entrySet.add(new AddressEntry(addressEntry.getKeyPair(),
|
requestPersistence();
|
||||||
AddressEntry.Context.AVAILABLE,
|
}
|
||||||
addressEntry.isSegwit()));
|
// If we have an address entry which shared the address with another one (shared maker fee offers use case)
|
||||||
if (setChangedByRemove || setChangedByAdd) {
|
// 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();
|
requestPersistence();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user