types.hpp: Move voting stuff to separate header
This commit is contained in:
parent
590f10a382
commit
cd6b574141
11 changed files with 184 additions and 124 deletions
|
|
@ -22,6 +22,7 @@ add_library( graphene_chain
|
||||||
protocol/block.cpp
|
protocol/block.cpp
|
||||||
protocol/fee_schedule.cpp
|
protocol/fee_schedule.cpp
|
||||||
protocol/confidential.cpp
|
protocol/confidential.cpp
|
||||||
|
protocol/vote.cpp
|
||||||
|
|
||||||
pts_address.cpp
|
pts_address.cpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#include <graphene/chain/database.hpp>
|
#include <graphene/chain/database.hpp>
|
||||||
#include <graphene/chain/account_object.hpp>
|
#include <graphene/chain/account_object.hpp>
|
||||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
#include <graphene/chain/protocol/fee_schedule.hpp>
|
||||||
|
#include <graphene/chain/protocol/vote.hpp>
|
||||||
#include <graphene/chain/transaction_evaluation_state.hpp>
|
#include <graphene/chain/transaction_evaluation_state.hpp>
|
||||||
|
|
||||||
#include <fc/smart_ref_impl.hpp>
|
#include <fc/smart_ref_impl.hpp>
|
||||||
|
|
@ -36,7 +37,7 @@ object_id_type committee_member_create_evaluator::do_apply( const committee_memb
|
||||||
{ try {
|
{ try {
|
||||||
vote_id_type vote_id;
|
vote_id_type vote_id;
|
||||||
db().modify(db().get_global_properties(), [&vote_id](global_property_object& p) {
|
db().modify(db().get_global_properties(), [&vote_id](global_property_object& p) {
|
||||||
vote_id = p.get_next_vote_id(vote_id_type::committee);
|
vote_id = get_next_vote_id(p, vote_id_type::committee);
|
||||||
});
|
});
|
||||||
|
|
||||||
const auto& new_del_object = db().create<committee_member_object>( [&]( committee_member_object& obj ){
|
const auto& new_del_object = db().create<committee_member_object>( [&]( committee_member_object& obj ){
|
||||||
|
|
@ -47,8 +48,6 @@ object_id_type committee_member_create_evaluator::do_apply( const committee_memb
|
||||||
return new_del_object.id;
|
return new_del_object.id;
|
||||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void_result committee_member_update_global_parameters_evaluator::do_evaluate(const committee_member_update_global_parameters_operation& o)
|
void_result committee_member_update_global_parameters_evaluator::do_evaluate(const committee_member_update_global_parameters_operation& o)
|
||||||
{ try {
|
{ try {
|
||||||
FC_ASSERT(trx_state->_is_proposed_trx);
|
FC_ASSERT(trx_state->_is_proposed_trx);
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,6 @@ namespace graphene { namespace chain {
|
||||||
flat_set<account_id_type> witness_accounts; // updated once per maintenance interval
|
flat_set<account_id_type> witness_accounts; // updated once per maintenance interval
|
||||||
|
|
||||||
fc::sha256 chain_id;
|
fc::sha256 chain_id;
|
||||||
|
|
||||||
vote_id_type get_next_vote_id(vote_id_type::vote_type type) {
|
|
||||||
return vote_id_type(type, next_available_vote_id++);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <graphene/chain/protocol/base.hpp>
|
#include <graphene/chain/protocol/base.hpp>
|
||||||
|
#include <graphene/chain/protocol/vote.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <graphene/chain/protocol/base.hpp>
|
||||||
#include <graphene/chain/protocol/types.hpp>
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
#include <fc/smart_ref_fwd.hpp>
|
#include <fc/smart_ref_fwd.hpp>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,9 +149,6 @@ namespace graphene { namespace chain {
|
||||||
meta_account_object_type
|
meta_account_object_type
|
||||||
};
|
};
|
||||||
|
|
||||||
struct chain_parameters;
|
|
||||||
|
|
||||||
|
|
||||||
//typedef fc::unsigned_int object_id_type;
|
//typedef fc::unsigned_int object_id_type;
|
||||||
//typedef uint64_t object_id_type;
|
//typedef uint64_t object_id_type;
|
||||||
class account_object;
|
class account_object;
|
||||||
|
|
@ -221,101 +218,6 @@ namespace graphene { namespace chain {
|
||||||
typedef fc::ripemd160 secret_hash_type;
|
typedef fc::ripemd160 secret_hash_type;
|
||||||
typedef uint16_t weight_type;
|
typedef uint16_t weight_type;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief An ID for some votable object
|
|
||||||
*
|
|
||||||
* This class stores an ID for a votable object. The ID is comprised of two fields: a type, and an instance. The
|
|
||||||
* type field stores which kind of object is being voted on, and the instance stores which specific object of that
|
|
||||||
* type is being referenced by this ID.
|
|
||||||
*
|
|
||||||
* A value of vote_id_type is implicitly convertible to an unsigned 32-bit integer containing only the instance. It
|
|
||||||
* may also be implicitly assigned from a uint32_t, which will update the instance. It may not, however, be
|
|
||||||
* implicitly constructed from a uint32_t, as in this case, the type would be unknown.
|
|
||||||
*
|
|
||||||
* On the wire, a vote_id_type is represented as a 32-bit integer with the type in the lower 8 bits and the instance
|
|
||||||
* in the upper 24 bits. This means that types may never exceed 8 bits, and instances may never exceed 24 bits.
|
|
||||||
*
|
|
||||||
* In JSON, a vote_id_type is represented as a string "type:instance", i.e. "1:5" would be type 1 and instance 5.
|
|
||||||
*
|
|
||||||
* @note In the Graphene protocol, vote_id_type instances are unique across types; that is to say, if an object of
|
|
||||||
* type 1 has instance 4, an object of type 0 may not also have instance 4. In other words, the type is not a
|
|
||||||
* namespace for instances; it is only an informational field.
|
|
||||||
*/
|
|
||||||
struct vote_id_type
|
|
||||||
{
|
|
||||||
/// Lower 8 bits are type; upper 24 bits are instance
|
|
||||||
uint32_t content;
|
|
||||||
|
|
||||||
enum vote_type
|
|
||||||
{
|
|
||||||
committee,
|
|
||||||
witness,
|
|
||||||
worker,
|
|
||||||
VOTE_TYPE_COUNT
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Default constructor. Sets type and instance to 0
|
|
||||||
vote_id_type():content(0){}
|
|
||||||
/// Construct this vote_id_type with provided type and instance
|
|
||||||
vote_id_type(vote_type type, uint32_t instance = 0)
|
|
||||||
: content(instance<<8 | type)
|
|
||||||
{}
|
|
||||||
/// Construct this vote_id_type from a serial string in the form "type:instance"
|
|
||||||
explicit vote_id_type(const std::string& serial)
|
|
||||||
{
|
|
||||||
auto colon = serial.find(':');
|
|
||||||
if( colon != string::npos )
|
|
||||||
*this = vote_id_type(vote_type(std::stoul(serial.substr(0, colon))), std::stoul(serial.substr(colon+1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set the type of this vote_id_type
|
|
||||||
void set_type(vote_type type)
|
|
||||||
{
|
|
||||||
content &= 0xffffff00;
|
|
||||||
content |= type & 0xff;
|
|
||||||
}
|
|
||||||
/// Get the type of this vote_id_type
|
|
||||||
vote_type type()const
|
|
||||||
{
|
|
||||||
return vote_type(content & 0xff);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set the instance of this vote_id_type
|
|
||||||
void set_instance(uint32_t instance)
|
|
||||||
{
|
|
||||||
assert(instance < 0x01000000);
|
|
||||||
content &= 0xff;
|
|
||||||
content |= instance << 8;
|
|
||||||
}
|
|
||||||
/// Get the instance of this vote_id_type
|
|
||||||
uint32_t instance()const
|
|
||||||
{
|
|
||||||
return content >> 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
vote_id_type& operator =(vote_id_type other)
|
|
||||||
{
|
|
||||||
content = other.content;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
/// Set the instance of this vote_id_type
|
|
||||||
vote_id_type& operator =(uint32_t instance)
|
|
||||||
{
|
|
||||||
set_instance(instance);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
/// Get the instance of this vote_id_type
|
|
||||||
operator uint32_t()const
|
|
||||||
{
|
|
||||||
return instance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Convert this vote_id_type to a serial string in the form "type:instance"
|
|
||||||
explicit operator std::string()const
|
|
||||||
{
|
|
||||||
return std::to_string(type()) + ":" + std::to_string(instance());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
struct public_key_type
|
struct public_key_type
|
||||||
{
|
{
|
||||||
struct binary_key
|
struct binary_key
|
||||||
|
|
@ -345,14 +247,7 @@ namespace fc
|
||||||
{
|
{
|
||||||
void to_variant( const graphene::chain::public_key_type& var, fc::variant& vo );
|
void to_variant( const graphene::chain::public_key_type& var, fc::variant& vo );
|
||||||
void from_variant( const fc::variant& var, graphene::chain::public_key_type& vo );
|
void from_variant( const fc::variant& var, graphene::chain::public_key_type& vo );
|
||||||
void to_variant( const graphene::chain::vote_id_type& var, fc::variant& vo );
|
|
||||||
void from_variant( const fc::variant& var, graphene::chain::vote_id_type& vo );
|
|
||||||
}
|
}
|
||||||
FC_REFLECT_TYPENAME( graphene::chain::vote_id_type::vote_type )
|
|
||||||
FC_REFLECT_TYPENAME( fc::flat_set<graphene::chain::vote_id_type> )
|
|
||||||
|
|
||||||
FC_REFLECT_ENUM( graphene::chain::vote_id_type::vote_type, (witness)(committee)(worker)(VOTE_TYPE_COUNT) )
|
|
||||||
FC_REFLECT( graphene::chain::vote_id_type, (content) )
|
|
||||||
|
|
||||||
FC_REFLECT( graphene::chain::public_key_type, (key_data) )
|
FC_REFLECT( graphene::chain::public_key_type, (key_data) )
|
||||||
FC_REFLECT( graphene::chain::public_key_type::binary_key, (data)(check) )
|
FC_REFLECT( graphene::chain::public_key_type::binary_key, (data)(check) )
|
||||||
|
|
|
||||||
146
libraries/chain/include/graphene/chain/protocol/vote.hpp
Normal file
146
libraries/chain/include/graphene/chain/protocol/vote.hpp
Normal file
|
|
@ -0,0 +1,146 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Cryptonomex, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is provided for evaluation in private test networks only, until September 8, 2015. After this date, this license expires and
|
||||||
|
* the code may not be used, modified or distributed for any purpose. Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted until September 8, 2015, provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. The code and/or derivative works are used only for private test networks consisting of no more than 10 P2P nodes.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <fc/container/flat.hpp>
|
||||||
|
#include <fc/reflect/reflect.hpp>
|
||||||
|
|
||||||
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief An ID for some votable object
|
||||||
|
*
|
||||||
|
* This class stores an ID for a votable object. The ID is comprised of two fields: a type, and an instance. The
|
||||||
|
* type field stores which kind of object is being voted on, and the instance stores which specific object of that
|
||||||
|
* type is being referenced by this ID.
|
||||||
|
*
|
||||||
|
* A value of vote_id_type is implicitly convertible to an unsigned 32-bit integer containing only the instance. It
|
||||||
|
* may also be implicitly assigned from a uint32_t, which will update the instance. It may not, however, be
|
||||||
|
* implicitly constructed from a uint32_t, as in this case, the type would be unknown.
|
||||||
|
*
|
||||||
|
* On the wire, a vote_id_type is represented as a 32-bit integer with the type in the lower 8 bits and the instance
|
||||||
|
* in the upper 24 bits. This means that types may never exceed 8 bits, and instances may never exceed 24 bits.
|
||||||
|
*
|
||||||
|
* In JSON, a vote_id_type is represented as a string "type:instance", i.e. "1:5" would be type 1 and instance 5.
|
||||||
|
*
|
||||||
|
* @note In the Graphene protocol, vote_id_type instances are unique across types; that is to say, if an object of
|
||||||
|
* type 1 has instance 4, an object of type 0 may not also have instance 4. In other words, the type is not a
|
||||||
|
* namespace for instances; it is only an informational field.
|
||||||
|
*/
|
||||||
|
struct vote_id_type
|
||||||
|
{
|
||||||
|
/// Lower 8 bits are type; upper 24 bits are instance
|
||||||
|
uint32_t content;
|
||||||
|
|
||||||
|
enum vote_type
|
||||||
|
{
|
||||||
|
committee,
|
||||||
|
witness,
|
||||||
|
worker,
|
||||||
|
VOTE_TYPE_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Default constructor. Sets type and instance to 0
|
||||||
|
vote_id_type():content(0){}
|
||||||
|
/// Construct this vote_id_type with provided type and instance
|
||||||
|
vote_id_type(vote_type type, uint32_t instance = 0)
|
||||||
|
: content(instance<<8 | type)
|
||||||
|
{}
|
||||||
|
/// Construct this vote_id_type from a serial string in the form "type:instance"
|
||||||
|
explicit vote_id_type(const std::string& serial)
|
||||||
|
{
|
||||||
|
auto colon = serial.find(':');
|
||||||
|
if( colon != std::string::npos )
|
||||||
|
*this = vote_id_type(vote_type(std::stoul(serial.substr(0, colon))), std::stoul(serial.substr(colon+1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set the type of this vote_id_type
|
||||||
|
void set_type(vote_type type)
|
||||||
|
{
|
||||||
|
content &= 0xffffff00;
|
||||||
|
content |= type & 0xff;
|
||||||
|
}
|
||||||
|
/// Get the type of this vote_id_type
|
||||||
|
vote_type type()const
|
||||||
|
{
|
||||||
|
return vote_type(content & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set the instance of this vote_id_type
|
||||||
|
void set_instance(uint32_t instance)
|
||||||
|
{
|
||||||
|
assert(instance < 0x01000000);
|
||||||
|
content &= 0xff;
|
||||||
|
content |= instance << 8;
|
||||||
|
}
|
||||||
|
/// Get the instance of this vote_id_type
|
||||||
|
uint32_t instance()const
|
||||||
|
{
|
||||||
|
return content >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
vote_id_type& operator =(vote_id_type other)
|
||||||
|
{
|
||||||
|
content = other.content;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
/// Set the instance of this vote_id_type
|
||||||
|
vote_id_type& operator =(uint32_t instance)
|
||||||
|
{
|
||||||
|
set_instance(instance);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
/// Get the instance of this vote_id_type
|
||||||
|
operator uint32_t()const
|
||||||
|
{
|
||||||
|
return instance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Convert this vote_id_type to a serial string in the form "type:instance"
|
||||||
|
explicit operator std::string()const
|
||||||
|
{
|
||||||
|
return std::to_string(type()) + ":" + std::to_string(instance());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class global_property_object;
|
||||||
|
|
||||||
|
vote_id_type get_next_vote_id( global_property_object& gpo, vote_id_type::vote_type type );
|
||||||
|
|
||||||
|
} } // graphene::chain
|
||||||
|
|
||||||
|
namespace fc
|
||||||
|
{
|
||||||
|
|
||||||
|
class variant;
|
||||||
|
|
||||||
|
void to_variant( const graphene::chain::vote_id_type& var, fc::variant& vo );
|
||||||
|
void from_variant( const fc::variant& var, graphene::chain::vote_id_type& vo );
|
||||||
|
|
||||||
|
} // fc
|
||||||
|
|
||||||
|
FC_REFLECT_TYPENAME( graphene::chain::vote_id_type::vote_type )
|
||||||
|
FC_REFLECT_TYPENAME( fc::flat_set<graphene::chain::vote_id_type> )
|
||||||
|
|
||||||
|
FC_REFLECT_ENUM( graphene::chain::vote_id_type::vote_type, (witness)(committee)(worker)(VOTE_TYPE_COUNT) )
|
||||||
|
FC_REFLECT( graphene::chain::vote_id_type, (content) )
|
||||||
|
|
@ -121,13 +121,4 @@ namespace fc
|
||||||
vo = graphene::chain::public_key_type( var.as_string() );
|
vo = graphene::chain::public_key_type( var.as_string() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void to_variant(const graphene::chain::vote_id_type& var, variant& vo)
|
|
||||||
{
|
|
||||||
vo = string(var);
|
|
||||||
}
|
|
||||||
void from_variant(const variant& var, graphene::chain::vote_id_type& vo)
|
|
||||||
{
|
|
||||||
vo = graphene::chain::vote_id_type(var.as_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // fc
|
} // fc
|
||||||
|
|
|
||||||
28
libraries/chain/protocol/vote.cpp
Normal file
28
libraries/chain/protocol/vote.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
#include <graphene/chain/global_property_object.hpp>
|
||||||
|
#include <graphene/chain/protocol/vote.hpp>
|
||||||
|
#include <fc/variant.hpp>
|
||||||
|
|
||||||
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
|
vote_id_type get_next_vote_id( global_property_object& gpo, vote_id_type::vote_type type )
|
||||||
|
{
|
||||||
|
return vote_id_type( type, gpo.next_available_vote_id++ );
|
||||||
|
}
|
||||||
|
|
||||||
|
} } // graphene::chain
|
||||||
|
|
||||||
|
namespace fc
|
||||||
|
{
|
||||||
|
|
||||||
|
void to_variant(const graphene::chain::vote_id_type& var, variant& vo)
|
||||||
|
{
|
||||||
|
vo = string(var);
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_variant(const variant& var, graphene::chain::vote_id_type& vo)
|
||||||
|
{
|
||||||
|
vo = graphene::chain::vote_id_type(var.as_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // fc
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#include <graphene/chain/committee_member_object.hpp>
|
#include <graphene/chain/committee_member_object.hpp>
|
||||||
#include <graphene/chain/account_object.hpp>
|
#include <graphene/chain/account_object.hpp>
|
||||||
#include <graphene/chain/database.hpp>
|
#include <graphene/chain/database.hpp>
|
||||||
|
#include <graphene/chain/protocol/vote.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
|
|
@ -33,7 +34,7 @@ object_id_type witness_create_evaluator::do_apply( const witness_create_operatio
|
||||||
{ try {
|
{ try {
|
||||||
vote_id_type vote_id;
|
vote_id_type vote_id;
|
||||||
db().modify(db().get_global_properties(), [&vote_id](global_property_object& p) {
|
db().modify(db().get_global_properties(), [&vote_id](global_property_object& p) {
|
||||||
vote_id = p.get_next_vote_id(vote_id_type::witness);
|
vote_id = get_next_vote_id(p, vote_id_type::witness);
|
||||||
});
|
});
|
||||||
|
|
||||||
const auto& new_witness_object = db().create<witness_object>( [&]( witness_object& obj ){
|
const auto& new_witness_object = db().create<witness_object>( [&]( witness_object& obj ){
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
#include <graphene/chain/worker_evaluator.hpp>
|
#include <graphene/chain/worker_evaluator.hpp>
|
||||||
#include <graphene/chain/vesting_balance_object.hpp>
|
#include <graphene/chain/vesting_balance_object.hpp>
|
||||||
#include <graphene/chain/account_object.hpp>
|
#include <graphene/chain/account_object.hpp>
|
||||||
|
#include <graphene/chain/protocol/vote.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
|
|
@ -74,8 +75,8 @@ object_id_type worker_create_evaluator::do_apply(const worker_create_evaluator::
|
||||||
database& d = db();
|
database& d = db();
|
||||||
vote_id_type for_id, against_id;
|
vote_id_type for_id, against_id;
|
||||||
d.modify(d.get_global_properties(), [&for_id, &against_id](global_property_object& p) {
|
d.modify(d.get_global_properties(), [&for_id, &against_id](global_property_object& p) {
|
||||||
for_id = p.get_next_vote_id(vote_id_type::worker);
|
for_id = get_next_vote_id(p, vote_id_type::worker);
|
||||||
against_id = p.get_next_vote_id(vote_id_type::worker);
|
against_id = get_next_vote_id(p, vote_id_type::worker);
|
||||||
});
|
});
|
||||||
|
|
||||||
return d.create<worker_object>([&](worker_object& w) {
|
return d.create<worker_object>([&](worker_object& w) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue