Skip to content

Commit

Permalink
Fall back to 100% if there are no loan schemes (#1472)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar authored Sep 15, 2022
1 parent 28f2b9e commit 4ad53cb
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 4ad53cb

Please sign in to comment.