mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04:00
republish offers awaits prices and runs off UserThread
This commit is contained in:
parent
dbd8db0e88
commit
26ea53883c
@ -863,7 +863,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||
// on error, create split output tx if not already created
|
||||
if (openOffer.getSplitOutputTxHash() == null) {
|
||||
int offerSubaddress = xmrWalletService.getOrCreateAddressEntry(openOffer.getId(), XmrAddressEntry.Context.OFFER_FUNDING).getSubaddressIndex();
|
||||
log.warn("Splitting new output because spending scheduled output(s) failed for offer {}. Split output tx subaddresses={}. Offer funding subadress={}", openOffer.getId(), splitOutputTx.getOutgoingTransfer().getSubaddressIndices(), offerSubaddress);
|
||||
log.warn("Splitting new output because spending scheduled output(s) failed for offer {}. Offer funding subadress={}", openOffer.getId(), offerSubaddress);
|
||||
splitOrSchedule(openOffers, openOffer, offerReserveAmount);
|
||||
resultHandler.handleResult(null);
|
||||
} else {
|
||||
@ -1569,7 +1569,11 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||
|
||||
stopPeriodicRefreshOffersTimer();
|
||||
|
||||
processListForRepublishOffers(getOpenOffers());
|
||||
priceFeedService.awaitPrices();
|
||||
|
||||
new Thread(() -> {
|
||||
processListForRepublishOffers(getOpenOffers());
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void processListForRepublishOffers(List<OpenOffer> list) {
|
||||
|
@ -137,6 +137,18 @@ public class PriceFeedService {
|
||||
request(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Awaits prices to be available, but does not request them.
|
||||
*/
|
||||
public void awaitPrices() {
|
||||
if (hasPrices()) return;
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
ChangeListener<? super Number> listener = (observable, oldValue, newValue) -> { latch.countDown(); };
|
||||
updateCounter.addListener(listener);
|
||||
HavenoUtils.awaitLatch(latch);
|
||||
updateCounter.removeListener(listener);
|
||||
}
|
||||
|
||||
public boolean hasPrices() {
|
||||
return !cache.isEmpty();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user