Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fixed_string for custom operation ID fields #3170 #3171

Merged
merged 1 commit into from
Nov 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2597,7 +2597,7 @@ void database::set_custom_operation_interpreter( const std::string& id, std::sha
FC_ASSERT( inserted );
}

std::shared_ptr< custom_operation_interpreter > database::get_custom_json_evaluator( const std::string& id )
std::shared_ptr< custom_operation_interpreter > database::get_custom_json_evaluator( const custom_id_type& id )
{
auto it = _custom_operation_interpreters.find( id );
if( it != _custom_operation_interpreters.end() )
Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/include/steem/chain/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ namespace steem { namespace chain {

void initialize_evaluators();
void set_custom_operation_interpreter( const std::string& id, std::shared_ptr< custom_operation_interpreter > registry );
std::shared_ptr< custom_operation_interpreter > get_custom_json_evaluator( const std::string& id );
std::shared_ptr< custom_operation_interpreter > get_custom_json_evaluator( const custom_id_type& id );

/// Reset the object graph in-memory
void initialize_indexes();
Expand Down Expand Up @@ -585,7 +585,7 @@ namespace steem { namespace chain {
uint16_t _shared_file_full_threshold = 0;
uint16_t _shared_file_scale_rate = 0;

flat_map< std::string, std::shared_ptr< custom_operation_interpreter > > _custom_operation_interpreters;
flat_map< custom_id_type, std::shared_ptr< custom_operation_interpreter > > _custom_operation_interpreters;
std::string _json_schema;

util::advanced_benchmark_dumper _benchmark_dumper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ namespace steem { namespace protocol {
{
flat_set< account_name_type > required_auths;
flat_set< account_name_type > required_posting_auths;
string id; ///< must be less than 32 characters long
custom_id_type id; ///< must be less than 32 characters long
string json; ///< must be proper utf8 / JSON string.

void validate()const;
Expand All @@ -587,7 +587,7 @@ namespace steem { namespace protocol {
flat_set< account_name_type > required_posting_auths;
vector< authority > required_auths;

string id; ///< must be less than 32 characters long
custom_id_type id; ///< must be less than 32 characters long
vector< char > data;

void validate()const;
Expand Down
1 change: 1 addition & 0 deletions libraries/protocol/include/steem/protocol/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ namespace steem {
typedef safe<int64_t> share_type;
typedef uint16_t weight_type;
typedef uint32_t contribution_id_type;
typedef fixed_string<32> custom_id_type;


struct public_key_type
Expand Down