Issue #67 - add name/url to worker create operation

This commit is contained in:
Daniel Larimer 2015-06-23 10:33:11 -04:00
parent 06a9488f8b
commit da4bf0adc2
3 changed files with 8 additions and 1 deletions

View file

@ -86,6 +86,9 @@
#define GRAPHENE_DEFAULT_MAX_ASSERT_OPCODE 1
#define GRAPHENE_GENESIS_TIMESTAMP (1431700000) /// Should be divisible by GRAPHENE_DEFAULT_BLOCK_INTERVAL
#define GRAPHENE_MAX_WORKER_NAME_LENGTH 63
#define GRAPHENE_MAX_WORKER_URL_LENGTH 127
// counter initialization values used to derive near and far future seeds for shuffling witnesses
// we use the fractional bits of sqrt(2) in hex
#define GRAPHENE_NEAR_SCHEDULE_CTR_IV ( (uint64_t( 0x6a09 ) << 0x30) \

View file

@ -1305,6 +1305,8 @@ namespace graphene { namespace chain {
time_point_sec work_begin_date;
time_point_sec work_end_date;
share_type daily_pay;
string name;
string url;
/// This should be set to the initializer appropriate for the type of worker to be created.
worker_initializer initializer;
@ -1613,7 +1615,7 @@ FC_REFLECT( graphene::chain::vesting_balance_create_operation, (fee)(creator)(ow
FC_REFLECT( graphene::chain::vesting_balance_withdraw_operation, (fee)(vesting_balance)(owner)(amount) )
FC_REFLECT( graphene::chain::worker_create_operation,
(fee)(owner)(work_begin_date)(work_end_date)(daily_pay)(initializer) )
(fee)(owner)(work_begin_date)(work_end_date)(daily_pay)(name)(url)(initializer) )
FC_REFLECT( graphene::chain::custom_operation, (fee)(payer)(required_auths)(id)(data) )
FC_REFLECT( graphene::chain::assert_operation, (fee)(fee_paying_account)(predicates)(required_auths) )

View file

@ -778,6 +778,8 @@ void worker_create_operation::validate() const
FC_ASSERT(work_end_date > work_begin_date);
FC_ASSERT(daily_pay > 0);
FC_ASSERT(daily_pay < GRAPHENE_BLOCKCHAIN_MAX_SHARES);
FC_ASSERT(name.size() < GRAPHENE_MAX_WORKER_NAME_LENGTH );
FC_ASSERT(url.size() < GRAPHENE_MAX_WORKER_URL_LENGTH );
}
share_type worker_create_operation::calculate_fee(const fee_schedule_type& k) const