From babf9f04035d87fca46dca68d827aa276edc0db4 Mon Sep 17 00:00:00 2001 From: Peter Bushnell Date: Tue, 5 May 2020 08:40:46 +0100 Subject: [PATCH] Pay exact amount for divisible tokens --- src/omnicore/rpctx.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/omnicore/rpctx.cpp b/src/omnicore/rpctx.cpp index 2315d5a60b68f..a8a2b2a919105 100644 --- a/src/omnicore/rpctx.cpp +++ b/src/omnicore/rpctx.cpp @@ -718,7 +718,11 @@ static UniValue omni_senddexpay(const JSONRPCRequest& request) const CAmount amountToPayInBTC = calculateDesiredBTC(acceptOffer->getOfferAmountOriginal(), acceptOffer->getBTCDesiredOriginal(), amountAccepted); if (nAmount > amountToPayInBTC) { - throw JSONRPCError(RPC_MISC_ERROR, strprintf("Paying more than required: %lld BTC to pay for %lld tokens", FormatMoney(amountToPayInBTC), FormatMoney(amountAccepted))); + throw JSONRPCError(RPC_MISC_ERROR, strprintf("Paying more than required: %lld BTC to pay for %lld tokens", FormatMoney(amountToPayInBTC), FormatMP(propertyId, amountAccepted))); + } + + if (!isPropertyDivisible(propertyId) && nAmount < amountToPayInBTC) { + throw JSONRPCError(RPC_MISC_ERROR, strprintf("Paying less than required: %lld BTC to pay for %lld tokens", FormatMoney(amountToPayInBTC), FormatMP(propertyId, amountAccepted))); } }