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

sqrrm notifications at github.com
Tue Oct 27 23:03: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.

My bad, thought this was already used by UI. Would be better to handle this with callbacks. That way it should be usable by both API and UI eventually.

-- 
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_r513083080
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201027/d8c85820/attachment-0001.html>


More information about the bisq-github mailing list