Remove redundant getTrade(id) method

Resolves issue found during https://github.com/bisq-network/bisq/pull/4673
review, and mentioned in comment
https://github.com/bisq-network/bisq/pull/4673#discussion_r510090257
This commit is contained in:
ghubstan 2020-10-22 10:09:35 -03:00
parent 2ae6bfaf51
commit fa0e05a336
No known key found for this signature in database
GPG Key ID: E35592D6800A861E

View File

@ -82,7 +82,7 @@ class CoreTradesService {
}
void confirmPaymentStarted(String tradeId) {
var trade = getTradeWithId(tradeId);
var trade = getTrade(tradeId);
if (isFollowingBuyerProtocol(trade)) {
var tradeProtocol = tradeManager.getTradeProtocol(trade);
((BuyerProtocol) tradeProtocol).onPaymentStarted(
@ -98,7 +98,7 @@ class CoreTradesService {
}
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 {
@ -114,10 +114,6 @@ class CoreTradesService {
}
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)));
}