[bisq-network/bisq] Block on tx-fee-request in core TakeOfferModel init (#4692)

sqrrm notifications at github.com
Thu Oct 29 21:19:16 UTC 2020


@sqrrm commented on this pull request.



> @@ -141,12 +160,19 @@ private void calculateTxFees() {
         // Payout tx: 371 bytes
         // Disputed payout tx: 408 bytes
 
-        // Request actual fees:
-        log.info("Start requestTxFee: txFeeFromFeeService={}", txFeeFromFeeService);
-        feeService.requestFees(() -> {
-            txFeePerByteFromFeeService = feeService.getTxFeePerByte();
-            txFeeFromFeeService = offerUtil.getTxFeeBySize(txFeePerByteFromFeeService, feeTxSize);
-        });
+        txFeePerByteFromFeeService = getTxFeePerByte();
+        txFeeFromFeeService = offerUtil.getTxFeeBySize(txFeePerByteFromFeeService, feeTxSize);
+        log.info("{} txFeePerByte = {}", feeService.getClass().getSimpleName(), txFeePerByteFromFeeService);
+    }
+
+    private Coin getTxFeePerByte() {
+        try {
+            CompletableFuture<Void> feeRequestFuture = CompletableFuture.runAsync(feeService::requestFees);
+            feeRequestFuture.get();  // Block until async fee request is complete.

Yeah, can be done in a later PR. Having it block is still more correct than before and since this is only used by API for now, it's not a problem to merge.

-- 
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/4692#discussion_r514573810
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201029/9b230e09/attachment.html>


More information about the bisq-github mailing list