Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back to 100% if there are no loan schemes #1472

Merged
merged 1 commit into from
Sep 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/masternodes/govvariables/attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CAmount>(&attribute.second); amount && *amount > COIN) {
return Res::Err("Percentage exceeds 100%%");
}
}
const auto factor = std::get_if<CAmount>(&attribute.second);
if (!factor) {
Expand Down