From 6145c3c89b4b758a10d5564c6973cfdcaff4e8d0 Mon Sep 17 00:00:00 2001 From: Milos Milosevic Date: Thu, 23 Feb 2023 13:25:39 +0100 Subject: [PATCH] Change default constructor of account_options --- libraries/chain/account_evaluator.cpp | 9 ++++++++- .../chain/include/graphene/chain/protocol/account.hpp | 11 +++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/libraries/chain/account_evaluator.cpp b/libraries/chain/account_evaluator.cpp index 4ecb3307..aec96049 100644 --- a/libraries/chain/account_evaluator.cpp +++ b/libraries/chain/account_evaluator.cpp @@ -193,7 +193,14 @@ object_id_type account_create_evaluator::do_apply( const account_create_operatio if (!obj.options.extensions.value.num_son.valid()) { - obj.options.extensions.value = account_options::ext(); + obj.options.extensions.value.num_son = []{ + flat_map num_son; + for(const auto& active_sidechain_type : all_sidechain_types){ + num_son[active_sidechain_type] = 0; + } + return num_son; + }(); + } obj.statistics = d.create([&obj](account_statistics_object& s){ diff --git a/libraries/chain/include/graphene/chain/protocol/account.hpp b/libraries/chain/include/graphene/chain/protocol/account.hpp index c8074885..5acb065c 100644 --- a/libraries/chain/include/graphene/chain/protocol/account.hpp +++ b/libraries/chain/include/graphene/chain/protocol/account.hpp @@ -36,21 +36,16 @@ namespace graphene { namespace chain { bool is_cheap_name( const string& n ); /// These are the fields which can be updated by the active authority. - struct account_options + struct account_options { struct ext { /// The number of active son members this account votes the blockchain should appoint /// Must not exceed the actual number of son members voted for in @ref votes - optional< flat_map > num_son = []{ - flat_map num_son; - for(const auto& active_sidechain_type : all_sidechain_types){ - num_son[active_sidechain_type] = 0; - } - return num_son; - }(); + optional< flat_map > num_son; }; + /// The memo key is the key this account will typically use to encrypt/sign transaction memos and other non- /// validated account activities. This field is here to prevent confusion if the active authority has zero or /// multiple keys in it.