<p></p>
<p><b>@chimp1984</b> commented on this pull request.</p>
<blockquote>
<p>utACK</p>
<p><a class="user-mention" data-hovercard-type="user" data-hovercard-url="/users/chimp1984/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/chimp1984">@chimp1984</a> what was the reason for not waiting for the fee here? Seems like it should.</p>
</blockquote>
<p>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...</p><hr>
<p>In <a href="https://github.com/bisq-network/bisq/pull/4692#discussion_r511497625">core/src/main/java/bisq/core/offer/takeoffer/TakeOfferModel.java</a>:</p>
<pre style='color:#555'>> @@ -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.
</pre>
<p>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?</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/4692#pullrequestreview-516295593">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNVOW5WY5PRK2SP7NTTSM5DTTANCNFSM4S4X2EAA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNRPAGDKSKOG3HZT553SM5DTTA5CNFSM4S4X2EAKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOD3DAXKI.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/4692#pullrequestreview-516295593",
"url": "https://github.com/bisq-network/bisq/pull/4692#pullrequestreview-516295593",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>