From 2fc3b0b4cb4fd0544337fd23b8c5580ea308e164 Mon Sep 17 00:00:00 2001 From: woodser Date: Tue, 20 Aug 2024 08:27:43 -0400 Subject: [PATCH] tolerate missing fees field from fee estimate --- src/main/java/monero/daemon/MoneroDaemonRpc.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/monero/daemon/MoneroDaemonRpc.java b/src/main/java/monero/daemon/MoneroDaemonRpc.java index cc16b56a..b9f42b1f 100644 --- a/src/main/java/monero/daemon/MoneroDaemonRpc.java +++ b/src/main/java/monero/daemon/MoneroDaemonRpc.java @@ -542,11 +542,15 @@ public MoneroFeeEstimate getFeeEstimate(Integer graceBlocks) { Map resp = rpc.sendJsonRequest("get_fee_estimate"); Map result = (Map) resp.get("result"); checkResponseStatus(result); - List fees = new ArrayList(); - for (BigInteger fee : (List) result.get("fees")) fees.add(fee); - BigInteger fee = (BigInteger) result.get("fee"); - BigInteger quantizationMask = (BigInteger) result.get("quantization_mask"); - return new MoneroFeeEstimate(fee, fees, quantizationMask); + MoneroFeeEstimate feeEstimate = new MoneroFeeEstimate(); + feeEstimate.setFee((BigInteger) result.get("fee")); + feeEstimate.setQuantizationMask((BigInteger) result.get("quantization_mask")); + if (result.containsKey("fees")) { + List fees = new ArrayList(); + for (BigInteger fee : (List) result.get("fees")) fees.add(fee); + feeEstimate.setFees(fees); + } + return feeEstimate; } @Override