mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-10-16 04:20:42 -04:00
fix offer message order by waiting 5s after edit offer start to publish (#2016)
This commit is contained in:
parent
ed41671df9
commit
c1f2ee9e77
1 changed files with 7 additions and 0 deletions
|
@ -62,6 +62,7 @@ import haveno.core.offer.OpenOfferManager;
|
|||
import haveno.core.payment.PaymentAccount;
|
||||
import haveno.core.proto.persistable.CorePersistenceProtoResolver;
|
||||
import haveno.core.provider.price.PriceFeedService;
|
||||
import haveno.core.trade.HavenoUtils;
|
||||
|
||||
import static haveno.core.payment.PaymentAccountUtil.isPaymentAccountValidForOffer;
|
||||
import haveno.core.user.User;
|
||||
|
@ -84,6 +85,8 @@ import org.bitcoinj.core.Transaction;
|
|||
@Slf4j
|
||||
public class CoreOffersService {
|
||||
|
||||
private static final long WAIT_FOR_EDIT_REMOVAL_MS = 5000;
|
||||
|
||||
private final Supplier<Comparator<Offer>> priceComparator = () -> comparing(Offer::getPrice);
|
||||
private final Supplier<Comparator<OpenOffer>> openOfferPriceComparator = () -> comparing(openOffer -> openOffer.getOffer().getPrice());
|
||||
private final Supplier<Comparator<Offer>> reversePriceComparator = () -> comparing(Offer::getPrice).reversed();
|
||||
|
@ -329,6 +332,10 @@ public class CoreOffersService {
|
|||
openOfferManager.editOpenOfferStart(openOffer, () -> {
|
||||
try {
|
||||
|
||||
// wait for remove offer to propagate
|
||||
// TODO: if offer edit is published too quickly, the remove message can be received after the add message, in which case the offer will be offline until the next offer refresh
|
||||
HavenoUtils.waitFor(WAIT_FOR_EDIT_REMOVAL_MS);
|
||||
|
||||
// create edited offer
|
||||
Price price = priceAsString.isEmpty() ? null : Price.valueOf(upperCaseCurrencyCode, priceStringToLong(priceAsString, upperCaseCurrencyCode));
|
||||
final OfferPayload newOfferPayload = createOfferService.createAndGetOffer(offerId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue