reserve correct offer amount based on buy or sell direction

This commit is contained in:
woodser 2022-07-15 18:23:54 -04:00
parent c97ca852f5
commit 6ca775da1b

View File

@ -287,10 +287,8 @@ public class Offer implements NetworkPayload, PersistablePayload {
// get the amount needed for the maker to reserve the offer
public Coin getReserveAmount() {
Coin reserveAmount = getAmount();
reserveAmount = reserveAmount.add(getDirection() == OfferDirection.BUY ?
getBuyerSecurityDeposit() :
getSellerSecurityDeposit());
Coin reserveAmount = getDirection() == OfferDirection.BUY ? getBuyerSecurityDeposit() : getSellerSecurityDeposit();
if (getDirection() == OfferDirection.SELL) reserveAmount = reserveAmount.add(getAmount());
return reserveAmount;
}