Skip to content

Commit

Permalink
Remove redundant getTrade(id) method
Browse files Browse the repository at this point in the history
Resolves issue found during bisq-network#4673
review, and mentioned in comment
bisq-network#4673 (comment)
  • Loading branch information
ghubstan committed Oct 22, 2020
1 parent 2ae6bfa commit fa0e05a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions core/src/main/java/bisq/core/api/CoreTradesService.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void takeOffer(Offer offer,
}

void confirmPaymentStarted(String tradeId) {
var trade = getTradeWithId(tradeId);
var trade = getTrade(tradeId);
if (isFollowingBuyerProtocol(trade)) {
var tradeProtocol = tradeManager.getTradeProtocol(trade);
((BuyerProtocol) tradeProtocol).onPaymentStarted(
Expand All @@ -98,7 +98,7 @@ void confirmPaymentStarted(String tradeId) {
}

void confirmPaymentReceived(String tradeId) {
var trade = getTradeWithId(tradeId);
var trade = getTrade(tradeId);
if (isFollowingBuyerProtocol(trade)) {
throw new IllegalStateException("you are the buyer, and not receiving payment");
} else {
Expand All @@ -114,10 +114,6 @@ void confirmPaymentReceived(String tradeId) {
}

Trade getTrade(String tradeId) {
return getTradeWithId(tradeId);
}

private Trade getTradeWithId(String tradeId) {
return tradeManager.getTradeById(tradeId).orElseThrow(() ->
new IllegalArgumentException(format("trade with id '%s' not found", tradeId)));
}
Expand Down

0 comments on commit fa0e05a

Please sign in to comment.