[bisq-network/bisq] Block on tx-fee-request in core TakeOfferModel init (#4692)
chimp1984
notifications at github.com
Tue Oct 27 22:37:45 UTC 2020
@chimp1984 commented on this pull request.
> utACK
>
> @chimp1984 what was the reason for not waiting for the fee here? Seems like it should.
I don't have the full context here, but I prefer to not add blocking code, but deal with asycn calls via callbacks. But if its API only and hard otherwise I am fine...
> @@ -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.
I assume that method is only used by API so far. But to make it usable for GUI app as well a blocking request is not possible as it would block the UI thread. Is there a strong reason why you need to do it blocking and not via a callback/result handler design?
--
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#pullrequestreview-516295593
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201027/cde7f985/attachment-0001.html>
More information about the bisq-github
mailing list