Merge pull request #1556 from darcys22/enforce-atomic-registrations-hf19

enforce atomic registrations in HF19
This commit is contained in:
Jason Rhinelander 2022-05-27 15:06:10 -03:00 committed by GitHub
commit 34a550b41f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -352,18 +352,20 @@ namespace service_nodes
{
if (reg.uses_portions)
{
if (hf_version > hf::hf19_reward_batching)
throw invalid_registration{"Portion-based registrations are not permitted after HF19"};
if (hf_version >= hf::hf19_reward_batching)
throw invalid_registration{"Portion-based registrations are not permitted in HF19+"};
}
else
{
// If not using portions then the hf value must be >= 19 and equal to the current blockchain hf:
if (hf_version < hf::hf19_reward_batching || reg.hf != static_cast<uint8_t>(hf_version))
throw invalid_registration{"Wrong registration hardfork " +
std::to_string(reg.hf) + ", != current " + std::to_string(static_cast<uint8_t>(hf_version))};
throw invalid_registration{fmt::format(
"Wrong registration hardfork {}; you likely need to regenerate "
"the registration for compatibility with hardfork {}",
reg.hf, static_cast<uint8_t>(hf_version))};
}
const size_t max_contributors = (hf_version >= hf::hf19_reward_batching && !reg.uses_portions)
const size_t max_contributors = hf_version >= hf::hf19_reward_batching
? oxen::MAX_CONTRIBUTORS_HF19
: oxen::MAX_CONTRIBUTORS_V1;