[bisq-network/bisq] Use existing timer in unlockwallet(pwd, timeout) (#4558)

chimp1984 notifications at github.com
Sat Sep 26 20:22:37 UTC 2020


@chimp1984 commented on this pull request.



> @@ -86,21 +90,53 @@ public void getOffers(GetOffersRequest req,
     @Override
     public void createOffer(CreateOfferRequest req,
                             StreamObserver<CreateOfferReply> responseObserver) {
-        TransactionResultHandler resultHandler = transaction -> {
-            CreateOfferReply reply = CreateOfferReply.newBuilder().setResult(true).build();
+        CountDownLatch latch = new CountDownLatch(1);
+        try {
+            TransactionResultHandler resultHandler = transaction -> {
+                latch.countDown();

I meant to move all to the handler directly.
```
TransactionResultHandler resultHandler = transaction -> {
Offer offer = coreApi.createOffer(
                    req.getCurrencyCode(),
                    req.getDirection(),
                    req.getPrice(),
                    req.getUseMarketBasedPrice(),
                    req.getMarketPriceMargin(),
                    req.getAmount(),
                    req.getMinAmount(),
                    req.getBuyerSecurityDeposit(),
                    req.getPaymentAccountId(),
                    resultHandler);

            OfferInfo offerInfo = new OfferInfo.OfferInfoBuilder()
                    .withId(offer.getId())
                    .withDirection(offer.getDirection().name())
                    .withPrice(offer.getPrice().getValue())
                    .withUseMarketBasedPrice(offer.isUseMarketBasedPrice())
                    .withMarketPriceMargin(offer.getMarketPriceMargin())
                    .withAmount(offer.getAmount().value)
                    .withMinAmount(offer.getMinAmount().value)
                    .withVolume(offer.getVolume().getValue())
                    .withMinVolume(offer.getMinVolume().getValue())
                    .withBuyerSecurityDeposit(offer.getBuyerSecurityDeposit().value)
                    .withPaymentAccountId(offer.getMakerPaymentAccountId())
                    .withPaymentMethodId(offer.getPaymentMethod().getId())
                    .withPaymentMethodShortName(offer.getPaymentMethod().getShortName())
                    .withBaseCurrencyCode(offer.getOfferPayload().getBaseCurrencyCode())
                    .withCounterCurrencyCode(offer.getOfferPayload().getCounterCurrencyCode())
                    .withDate(offer.getDate().getTime())
                    .build();
            CreateOfferReply reply = CreateOfferReply.newBuilder().setOffer(offerInfo.toProtoMessage()).build();
            responseObserver.onNext(reply);
            responseObserver.onCompleted();
}
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/4558#discussion_r495492041
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20200926/679b6788/attachment.html>


More information about the bisq-github mailing list