This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #241 from brianjohnson5972/trx_by_key_166
Account lookup by key
- Loading branch information
Showing
6 changed files
with
189 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...s/account_history_plugin/include/eos/account_history_plugin/public_key_history_object.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#pragma once | ||
|
||
#include <chainbase/chainbase.hpp> | ||
#include <fc/array.hpp> | ||
|
||
namespace std { | ||
|
||
template<> | ||
struct hash<eos::chain::public_key_type> | ||
{ | ||
size_t operator()( const eos::chain::public_key_type& key ) const | ||
{ | ||
std::hash<fc::ecc::public_key_data> hash; | ||
return hash(key.key_data); | ||
} | ||
}; | ||
} | ||
|
||
namespace eos { | ||
using chain::AccountName; | ||
using chain::public_key_type; | ||
using chain::PermissionName; | ||
using namespace boost::multi_index; | ||
|
||
class public_key_history_object : public chainbase::object<chain::public_key_history_object_type, public_key_history_object> { | ||
OBJECT_CTOR(public_key_history_object) | ||
|
||
id_type id; | ||
public_key_type public_key; | ||
AccountName account_name; | ||
PermissionName permission; | ||
}; | ||
|
||
struct by_id; | ||
struct by_pub_key; | ||
struct by_account_permission; | ||
using public_key_history_multi_index = chainbase::shared_multi_index_container< | ||
public_key_history_object, | ||
indexed_by< | ||
ordered_unique<tag<by_id>, BOOST_MULTI_INDEX_MEMBER(public_key_history_object, public_key_history_object::id_type, id)>, | ||
hashed_non_unique<tag<by_pub_key>, BOOST_MULTI_INDEX_MEMBER(public_key_history_object, public_key_type, public_key), std::hash<public_key_type> >, | ||
hashed_non_unique<tag<by_account_permission>, | ||
composite_key< public_key_history_object, | ||
member<public_key_history_object, AccountName, &public_key_history_object::account_name>, | ||
member<public_key_history_object, PermissionName, &public_key_history_object::permission> | ||
>, | ||
composite_key_hash< | ||
std::hash<AccountName>, | ||
std::hash<PermissionName> | ||
> | ||
> | ||
> | ||
>; | ||
|
||
typedef chainbase::generic_index<public_key_history_multi_index> public_key_history_index; | ||
|
||
} | ||
|
||
CHAINBASE_SET_INDEX_TYPE( eos::public_key_history_object, eos::public_key_history_multi_index ) | ||
|
||
FC_REFLECT( eos::public_key_history_object, (public_key)(account_name)(permission) ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters