diff --git a/core/src/main/java/bisq/core/api/CoreWalletsService.java b/core/src/main/java/bisq/core/api/CoreWalletsService.java index 077d67fb..a8cd27f2 100644 --- a/core/src/main/java/bisq/core/api/CoreWalletsService.java +++ b/core/src/main/java/bisq/core/api/CoreWalletsService.java @@ -543,7 +543,8 @@ class CoreWalletsService { if (reservedTradeBalance == null) throw new IllegalStateException("reserved trade balance is not yet available"); - return new XmrBalanceInfo(availableBalance.longValue(), + return new XmrBalanceInfo(availableBalance.longValue() + lockedBalance.longValue(), + availableBalance.longValue(), lockedBalance.longValue(), reservedOfferBalance.longValue(), reservedTradeBalance.longValue()); diff --git a/core/src/main/java/bisq/core/api/model/XmrBalanceInfo.java b/core/src/main/java/bisq/core/api/model/XmrBalanceInfo.java index a4e79843..83f4dfd1 100644 --- a/core/src/main/java/bisq/core/api/model/XmrBalanceInfo.java +++ b/core/src/main/java/bisq/core/api/model/XmrBalanceInfo.java @@ -10,20 +10,24 @@ import lombok.Getter; public class XmrBalanceInfo implements Payload { public static final XmrBalanceInfo EMPTY = new XmrBalanceInfo(-1, + -1, -1, -1, -1); // all balances are in atomic units + private final long balance; private final long unlockedBalance; private final long lockedBalance; private final long reservedOfferBalance; private final long reservedTradeBalance; - public XmrBalanceInfo(long unlockedBalance, + public XmrBalanceInfo(long balance, + long unlockedBalance, long lockedBalance, long reservedOfferBalance, long reservedTradeBalance) { + this.balance = balance; this.unlockedBalance = unlockedBalance; this.lockedBalance = lockedBalance; this.reservedOfferBalance = reservedOfferBalance; @@ -31,11 +35,13 @@ public class XmrBalanceInfo implements Payload { } @VisibleForTesting - public static XmrBalanceInfo valueOf(long unlockedBalance, + public static XmrBalanceInfo valueOf(long balance, + long unlockedBalance, long lockedBalance, long reservedOfferBalance, long reservedTradeBalance) { - return new XmrBalanceInfo(unlockedBalance, + return new XmrBalanceInfo(balance, + unlockedBalance, lockedBalance, reservedOfferBalance, reservedTradeBalance); @@ -48,6 +54,7 @@ public class XmrBalanceInfo implements Payload { @Override public bisq.proto.grpc.XmrBalanceInfo toProtoMessage() { return bisq.proto.grpc.XmrBalanceInfo.newBuilder() + .setBalance(balance) .setUnlockedBalance(unlockedBalance) .setLockedBalance(lockedBalance) .setReservedOfferBalance(reservedOfferBalance) @@ -56,7 +63,8 @@ public class XmrBalanceInfo implements Payload { } public static XmrBalanceInfo fromProto(bisq.proto.grpc.XmrBalanceInfo proto) { - return new XmrBalanceInfo(proto.getUnlockedBalance(), + return new XmrBalanceInfo(proto.getBalance(), + proto.getUnlockedBalance(), proto.getLockedBalance(), proto.getReservedOfferBalance(), proto.getReservedTradeBalance()); @@ -64,7 +72,8 @@ public class XmrBalanceInfo implements Payload { @Override public String toString() { - return "BtcBalanceInfo{" + + return "XmrBalanceInfo{" + + "balance=" + balance + "unlockedBalance=" + unlockedBalance + ", lockedBalance=" + lockedBalance + ", reservedOfferBalance=" + reservedOfferBalance + diff --git a/core/src/main/java/bisq/core/offer/placeoffer/tasks/MakerProcessesSignOfferResponse.java b/core/src/main/java/bisq/core/offer/placeoffer/tasks/MakerProcessesSignOfferResponse.java index ed74e1f9..8e764bc2 100644 --- a/core/src/main/java/bisq/core/offer/placeoffer/tasks/MakerProcessesSignOfferResponse.java +++ b/core/src/main/java/bisq/core/offer/placeoffer/tasks/MakerProcessesSignOfferResponse.java @@ -46,7 +46,7 @@ public class MakerProcessesSignOfferResponse extends Task { // set arbitrator signature for maker's offer model.getOffer().getOfferPayload().setArbitratorSignature(model.getSignOfferResponse().getSignedOfferPayload().getArbitratorSignature()); - + offer.setState(Offer.State.AVAILABLE); complete(); } catch (Exception e) { offer.setErrorMessage("An error occurred.\n" + diff --git a/core/src/main/java/bisq/core/offer/placeoffer/tasks/MakerReservesTradeFunds.java b/core/src/main/java/bisq/core/offer/placeoffer/tasks/MakerReservesTradeFunds.java index 74a7dea8..1360f6b2 100644 --- a/core/src/main/java/bisq/core/offer/placeoffer/tasks/MakerReservesTradeFunds.java +++ b/core/src/main/java/bisq/core/offer/placeoffer/tasks/MakerReservesTradeFunds.java @@ -65,7 +65,6 @@ public class MakerReservesTradeFunds extends Task { model.setReserveTx(reserveTx); offer.getOfferPayload().setReserveTxKeyImages(reservedKeyImages); offer.setOfferFeePaymentTxId(reserveTx.getHash()); // TODO (woodser): don't use this field - offer.setState(Offer.State.OFFER_FEE_RESERVED); complete(); } catch (Throwable t) { offer.setErrorMessage("An error occurred.\n" + diff --git a/core/src/main/java/bisq/core/offer/placeoffer/tasks/MakerSendsSignOfferRequest.java b/core/src/main/java/bisq/core/offer/placeoffer/tasks/MakerSendsSignOfferRequest.java index a9038170..1e0929ff 100644 --- a/core/src/main/java/bisq/core/offer/placeoffer/tasks/MakerSendsSignOfferRequest.java +++ b/core/src/main/java/bisq/core/offer/placeoffer/tasks/MakerSendsSignOfferRequest.java @@ -74,6 +74,7 @@ public class MakerSendsSignOfferRequest extends Task { model.getP2PService().sendEncryptedDirectMessage(arbitrator.getNodeAddress(), arbitrator.getPubKeyRing(), request, new SendDirectMessageListener() { @Override public void onArrived() { + offer.setState(Offer.State.OFFER_FEE_RESERVED); log.info("{} arrived: arbitrator={}; offerId={}; uid={}", request.getClass().getSimpleName(), arbitrator.getNodeAddress(), offer.getId()); complete(); } diff --git a/daemon/src/main/java/bisq/daemon/grpc/GrpcTradesService.java b/daemon/src/main/java/bisq/daemon/grpc/GrpcTradesService.java index 2d1992f4..7be43847 100644 --- a/daemon/src/main/java/bisq/daemon/grpc/GrpcTradesService.java +++ b/daemon/src/main/java/bisq/daemon/grpc/GrpcTradesService.java @@ -173,7 +173,7 @@ class GrpcTradesService extends TradesImplBase { return getCustomRateMeteringInterceptor(coreApi.getConfig().appDataDir, this.getClass()) .or(() -> Optional.of(CallRateMeteringInterceptor.valueOf( new HashMap<>() {{ - put(getGetTradeMethod().getFullMethodName(), new GrpcCallRateMeter(1, SECONDS)); + put(getGetTradeMethod().getFullMethodName(), new GrpcCallRateMeter(3, SECONDS)); put(getTakeOfferMethod().getFullMethodName(), new GrpcCallRateMeter(1, SECONDS)); put(getConfirmPaymentStartedMethod().getFullMethodName(), new GrpcCallRateMeter(1, SECONDS)); put(getConfirmPaymentReceivedMethod().getFullMethodName(), new GrpcCallRateMeter(1, SECONDS)); diff --git a/proto/src/main/proto/grpc.proto b/proto/src/main/proto/grpc.proto index 0229cd52..49383129 100644 --- a/proto/src/main/proto/grpc.proto +++ b/proto/src/main/proto/grpc.proto @@ -570,10 +570,11 @@ message BtcBalanceInfo { } message XmrBalanceInfo { - uint64 unlocked_balance = 1 [jstype = JS_STRING]; - uint64 locked_balance = 2 [jstype = JS_STRING]; - uint64 reserved_offer_balance = 3 [jstype = JS_STRING]; - uint64 reserved_trade_balance = 4 [jstype = JS_STRING]; + uint64 balance = 1 [jstype = JS_STRING]; + uint64 unlocked_balance = 2 [jstype = JS_STRING]; + uint64 locked_balance = 3 [jstype = JS_STRING]; + uint64 reserved_offer_balance = 4 [jstype = JS_STRING]; + uint64 reserved_trade_balance = 5 [jstype = JS_STRING]; } message AddressBalanceInfo {