Drop Nx requirements for PS collaterals (#1995)

This commit is contained in:
UdjinM6 2018-03-19 16:08:57 +03:00 committed by GitHub
parent 9e98c856f2
commit 4f978a2634
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -306,14 +306,11 @@ bool CPrivateSend::IsCollateralValid(const CTransaction& txCollateral)
bool CPrivateSend::IsCollateralAmount(CAmount nInputAmount) bool CPrivateSend::IsCollateralAmount(CAmount nInputAmount)
{ {
if (mnpayments.GetMinMasternodePaymentsProto() > 70208) { if (mnpayments.GetMinMasternodePaymentsProto() > 70208) {
// collateral input should be smth between 1x and 2x OR exactly Nx of mixing collateral (1x..4x) // collateral input can be anything between 1x and "max" (including both)
return (nInputAmount > GetCollateralAmount() && nInputAmount < GetCollateralAmount() * 2) || return (nInputAmount >= GetCollateralAmount() && nInputAmount <= GetMaxCollateralAmount());
(nInputAmount >= GetCollateralAmount() && nInputAmount <= GetMaxCollateralAmount() && nInputAmount % GetCollateralAmount() == 0);
} else { // <= 70208 } else { // <= 70208
// collateral input should be exactly Nx of mixing collateral (2x..4x) // collateral input can be anything between 2x and "max" (including both)
return (nInputAmount >= GetCollateralAmount() * 2 && return (nInputAmount >= GetCollateralAmount() * 2 && nInputAmount <= GetMaxCollateralAmount());
nInputAmount <= GetMaxCollateralAmount() &&
nInputAmount % GetCollateralAmount() == 0);
} }
} }