mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 19:49:32 +00:00
republish offers awaits prices and runs off UserThread
This commit is contained in:
parent
dbd8db0e88
commit
26ea53883c
2 changed files with 18 additions and 2 deletions
|
@ -863,7 +863,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
// on error, create split output tx if not already created
|
// on error, create split output tx if not already created
|
||||||
if (openOffer.getSplitOutputTxHash() == null) {
|
if (openOffer.getSplitOutputTxHash() == null) {
|
||||||
int offerSubaddress = xmrWalletService.getOrCreateAddressEntry(openOffer.getId(), XmrAddressEntry.Context.OFFER_FUNDING).getSubaddressIndex();
|
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);
|
splitOrSchedule(openOffers, openOffer, offerReserveAmount);
|
||||||
resultHandler.handleResult(null);
|
resultHandler.handleResult(null);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1569,7 +1569,11 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
|
|
||||||
stopPeriodicRefreshOffersTimer();
|
stopPeriodicRefreshOffersTimer();
|
||||||
|
|
||||||
processListForRepublishOffers(getOpenOffers());
|
priceFeedService.awaitPrices();
|
||||||
|
|
||||||
|
new Thread(() -> {
|
||||||
|
processListForRepublishOffers(getOpenOffers());
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processListForRepublishOffers(List<OpenOffer> list) {
|
private void processListForRepublishOffers(List<OpenOffer> list) {
|
||||||
|
|
|
@ -137,6 +137,18 @@ public class PriceFeedService {
|
||||||
request(false);
|
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() {
|
public boolean hasPrices() {
|
||||||
return !cache.isEmpty();
|
return !cache.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue