From 18b163b99ee323a69105df6492ca8739c4d6d3e5 Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Tue, 9 Jun 2015 17:05:30 -0400 Subject: [PATCH] Progress #31: Fix genesis initialization --- libraries/chain/db_init.cpp | 5 +++++ libraries/chain/include/graphene/chain/account_object.hpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/chain/db_init.cpp b/libraries/chain/db_init.cpp index 811f99ce..b2f3dacd 100644 --- a/libraries/chain/db_init.cpp +++ b/libraries/chain/db_init.cpp @@ -153,6 +153,7 @@ void database::init_genesis(const genesis_allocation& initial_allocation) }); const account_object& genesis_account = create( [&](account_object& n) { + n.membership_expiration_date = time_point_sec::maximum(); n.name = "genesis"; n.owner.add_authority(genesis_key.get_id(), 1); n.owner.weight_threshold = 1; @@ -174,6 +175,10 @@ void database::init_genesis(const genesis_allocation& initial_allocation) const account_object& delegate_account = create( [&](account_object& a) { a.active = a.owner = genesis_account.owner; + a.referrer = account_id_type(i); + a.registrar = account_id_type(i); + a.lifetime_referrer = account_id_type(i); + a.membership_expiration_date = fc::time_point_sec::maximum(); a.name = string("init") + fc::to_string(i); a.statistics = stats_obj.id; }); diff --git a/libraries/chain/include/graphene/chain/account_object.hpp b/libraries/chain/include/graphene/chain/account_object.hpp index 9306a486..be74e87d 100644 --- a/libraries/chain/include/graphene/chain/account_object.hpp +++ b/libraries/chain/include/graphene/chain/account_object.hpp @@ -184,7 +184,7 @@ namespace graphene { namespace chain { /// @return true if this is a lifetime member account; false otherwise. bool is_lifetime_member()const { - return get_id() == referrer; + return membership_expiration_date == time_point_sec::maximum(); } /// @return true if this is a basic account; false otherwise. bool is_basic_account(time_point_sec now)const