Resolve #67: Add name and/or URL to witness/worker/delegate objects

This commit is contained in:
Nathan Hourt 2015-06-29 10:01:42 -04:00
parent 6279515c54
commit f4342d98ae
6 changed files with 34 additions and 22 deletions

View file

@ -39,6 +39,7 @@ object_id_type delegate_create_evaluator::do_apply( const delegate_create_operat
const auto& new_del_object = db().create<delegate_object>( [&]( delegate_object& obj ){ const auto& new_del_object = db().create<delegate_object>( [&]( delegate_object& obj ){
obj.delegate_account = op.delegate_account; obj.delegate_account = op.delegate_account;
obj.vote_id = vote_id; obj.vote_id = vote_id;
obj.url = op.url;
}); });
return new_del_object.id; return new_del_object.id;
} FC_CAPTURE_AND_RETHROW( (op) ) } } FC_CAPTURE_AND_RETHROW( (op) ) }

View file

@ -44,6 +44,7 @@ namespace graphene { namespace chain {
account_id_type delegate_account; account_id_type delegate_account;
vote_id_type vote_id; vote_id_type vote_id;
string url;
}; };
struct by_account; struct by_account;
@ -62,5 +63,4 @@ namespace graphene { namespace chain {
} } // graphene::chain } } // graphene::chain
FC_REFLECT_DERIVED( graphene::chain::delegate_object, (graphene::db::object), FC_REFLECT_DERIVED( graphene::chain::delegate_object, (graphene::db::object),
(delegate_account) (delegate_account)(vote_id)(url) )
(vote_id) )

View file

@ -37,6 +37,7 @@ namespace graphene { namespace chain {
secret_hash_type last_secret; secret_hash_type last_secret;
share_type accumulated_income; share_type accumulated_income;
vote_id_type vote_id; vote_id_type vote_id;
string url;
witness_object() : vote_id(vote_id_type::witness) {} witness_object() : vote_id(vote_id_type::witness) {}
}; };
@ -62,4 +63,5 @@ FC_REFLECT_DERIVED( graphene::chain::witness_object, (graphene::db::object),
(next_secret) (next_secret)
(last_secret) (last_secret)
(accumulated_income) (accumulated_income)
(vote_id) ) (vote_id)
(url) )

View file

@ -187,6 +187,10 @@ namespace graphene { namespace chain {
share_type daily_pay; share_type daily_pay;
/// ID of this worker's pay balance /// ID of this worker's pay balance
worker_type worker; worker_type worker;
/// Human-readable name for the worker
string name;
/// URL to a web page representing this worker
string url;
/// Voting ID which represents approval of this worker /// Voting ID which represents approval of this worker
vote_id_type vote_for; vote_id_type vote_for;
@ -221,4 +225,6 @@ FC_REFLECT_DERIVED( graphene::chain::worker_object, (graphene::db::object),
(worker) (worker)
(vote_for) (vote_for)
(vote_against) (vote_against)
(name)
(url)
) )

View file

@ -42,6 +42,7 @@ object_id_type witness_create_evaluator::do_apply( const witness_create_operatio
obj.vote_id = vote_id; obj.vote_id = vote_id;
obj.signing_key = op.block_signing_key; obj.signing_key = op.block_signing_key;
obj.next_secret = op.initial_secret; obj.next_secret = op.initial_secret;
obj.url = op.url;
}); });
return new_witness_object.id; return new_witness_object.id;
} FC_CAPTURE_AND_RETHROW( (op) ) } } FC_CAPTURE_AND_RETHROW( (op) ) }

View file

@ -46,6 +46,8 @@ object_id_type worker_create_evaluator::do_apply(const worker_create_evaluator::
w.daily_pay = o.daily_pay; w.daily_pay = o.daily_pay;
w.work_begin_date = o.work_begin_date; w.work_begin_date = o.work_begin_date;
w.work_end_date = o.work_end_date; w.work_end_date = o.work_end_date;
w.name = o.name;
w.url = o.url;
w.vote_for = for_id; w.vote_for = for_id;
w.vote_against = against_id; w.vote_against = against_id;
w.worker.set_which(o.initializer.which()); w.worker.set_which(o.initializer.which());