Change default constructor of num_son extension in account_options #789
2 changed files with 24 additions and 9 deletions
|
|
@ -193,7 +193,14 @@ object_id_type account_create_evaluator::do_apply( const account_create_operatio
|
||||||
|
|
||||||
if (!obj.options.extensions.value.num_son.valid())
|
if (!obj.options.extensions.value.num_son.valid())
|
||||||
{
|
{
|
||||||
obj.options.extensions.value = account_options::ext();
|
obj.options.extensions.value.num_son = []{
|
||||||
|
flat_map<sidechain_type, uint16_t> num_son;
|
||||||
|
for(const auto& active_sidechain_type : all_sidechain_types){
|
||||||
|
num_son[active_sidechain_type] = 0;
|
||||||
|
}
|
||||||
|
return num_son;
|
||||||
|
}();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.statistics = d.create<account_statistics_object>([&obj](account_statistics_object& s){
|
obj.statistics = d.create<account_statistics_object>([&obj](account_statistics_object& s){
|
||||||
|
|
@ -335,6 +342,19 @@ void_result account_update_evaluator::do_apply( const account_update_operation&
|
||||||
a.top_n_control_flags = 0;
|
a.top_n_control_flags = 0;
|
||||||
}
|
}
|
||||||
if( o.new_options ) a.options = *o.new_options;
|
if( o.new_options ) a.options = *o.new_options;
|
||||||
|
|
||||||
|
if (!a.options.extensions.value.num_son.valid())
|
||||||
|
{
|
||||||
|
a.options.extensions.value.num_son = []{
|
||||||
|
flat_map<sidechain_type, uint16_t> num_son;
|
||||||
|
for(const auto& active_sidechain_type : all_sidechain_types){
|
||||||
|
num_son[active_sidechain_type] = 0;
|
||||||
|
}
|
||||||
|
return num_son;
|
||||||
|
}();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if( o.extensions.value.owner_special_authority.valid() )
|
if( o.extensions.value.owner_special_authority.valid() )
|
||||||
{
|
{
|
||||||
a.owner_special_authority = *(o.extensions.value.owner_special_authority);
|
a.owner_special_authority = *(o.extensions.value.owner_special_authority);
|
||||||
|
|
|
||||||
|
|
@ -36,21 +36,16 @@ namespace graphene { namespace chain {
|
||||||
bool is_cheap_name( const string& n );
|
bool is_cheap_name( const string& n );
|
||||||
|
|
||||||
/// These are the fields which can be updated by the active authority.
|
/// These are the fields which can be updated by the active authority.
|
||||||
struct account_options
|
struct account_options
|
||||||
{
|
{
|
||||||
struct ext
|
struct ext
|
||||||
{
|
{
|
||||||
/// The number of active son members this account votes the blockchain should appoint
|
/// 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
|
/// Must not exceed the actual number of son members voted for in @ref votes
|
||||||
optional< flat_map<sidechain_type, uint16_t> > num_son = []{
|
optional< flat_map<sidechain_type, uint16_t> > num_son;
|
||||||
flat_map<sidechain_type, uint16_t> num_son;
|
|
||||||
for(const auto& active_sidechain_type : all_sidechain_types){
|
|
||||||
num_son[active_sidechain_type] = 0;
|
|
||||||
}
|
|
||||||
return num_son;
|
|
||||||
}();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// The memo key is the key this account will typically use to encrypt/sign transaction memos and other non-
|
/// 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
|
/// validated account activities. This field is here to prevent confusion if the active authority has zero or
|
||||||
/// multiple keys in it.
|
/// multiple keys in it.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue