From f5abce088f74f225ee63a97d1d74ab8e845694d6 Mon Sep 17 00:00:00 2001 From: Peter Bushnell Date: Thu, 15 Sep 2022 08:55:12 +0100 Subject: [PATCH] Fall back to 100% if there are no loan schemes --- src/masternodes/govvariables/attributes.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/masternodes/govvariables/attributes.cpp b/src/masternodes/govvariables/attributes.cpp index 4227294687f..2ac0147c879 100644 --- a/src/masternodes/govvariables/attributes.cpp +++ b/src/masternodes/govvariables/attributes.cpp @@ -1215,8 +1215,11 @@ Res ATTRIBUTES::Apply(CCustomCSView & mnview, const uint32_t height) ratio.insert(data.ratio); return true; }); + // No loan schemes, fall back to 100% limit if (ratio.empty()) { - return Res::Err("Set loan scheme before setting collateral factor."); + if (const auto amount = std::get_if(&attribute.second); amount && *amount > COIN) { + return Res::Err("Percentage exceeds 100%%"); + } } const auto factor = std::get_if(&attribute.second); if (!factor) {