diff --git a/libraries/chain/db_init.cpp b/libraries/chain/db_init.cpp index 208a48a6..40844ee2 100644 --- a/libraries/chain/db_init.cpp +++ b/libraries/chain/db_init.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include @@ -313,6 +314,7 @@ void database::initialize_indexes() add_index< primary_index >(); add_index< primary_index >(); add_index< primary_index >(); + add_index< primary_index >(); } void database::init_genesis(const genesis_state_type& genesis_state) diff --git a/libraries/chain/include/graphene/chain/protocol/types.hpp b/libraries/chain/include/graphene/chain/protocol/types.hpp index dbd8bc67..b01e9eae 100644 --- a/libraries/chain/include/graphene/chain/protocol/types.hpp +++ b/libraries/chain/include/graphene/chain/protocol/types.hpp @@ -148,6 +148,7 @@ namespace graphene { namespace chain { info_for_vout_object_type, bitcoin_address_object_type, primary_wallet_vout_object_type, + sidechain_proposal_object_type, OBJECT_TYPE_COUNT ///< Sentry value which contains the number of different object types }; @@ -208,6 +209,7 @@ namespace graphene { namespace chain { class info_for_vout_object; class bitcoin_address_object; class primary_wallet_vout_object; + class sidechain_proposal_object; typedef object_id< protocol_ids, account_object_type, account_object> account_id_type; typedef object_id< protocol_ids, asset_object_type, asset_object> asset_id_type; @@ -237,6 +239,7 @@ namespace graphene { namespace chain { typedef object_id< protocol_ids, info_for_vout_object_type, info_for_vout_object> info_for_vout_id_type; typedef object_id< protocol_ids, bitcoin_address_object_type, bitcoin_address_object> bitcoin_address_id_type; typedef object_id< protocol_ids, primary_wallet_vout_object_type,primary_wallet_vout_object> primary_wallet_vout_id_type; + typedef object_id< protocol_ids, sidechain_proposal_object_type, sidechain_proposal_object> sidechain_proposal_id_type; // implementation types class global_property_object; @@ -414,6 +417,7 @@ FC_REFLECT_ENUM( graphene::chain::object_type, (info_for_vout_object_type) (bitcoin_address_object_type) (primary_wallet_vout_object_type) + (sidechain_proposal_object_type) (OBJECT_TYPE_COUNT) ) FC_REFLECT_ENUM( graphene::chain::impl_object_type, @@ -468,6 +472,7 @@ FC_REFLECT_TYPENAME( graphene::chain::tournament_id_type ) FC_REFLECT_TYPENAME( graphene::chain::info_for_vout_id_type ) FC_REFLECT_TYPENAME( graphene::chain::bitcoin_address_id_type ) FC_REFLECT_TYPENAME( graphene::chain::primary_wallet_vout_id_type ) +FC_REFLECT_TYPENAME( graphene::chain::sidechain_proposal_id_type ) FC_REFLECT_TYPENAME( graphene::chain::global_property_id_type ) FC_REFLECT_TYPENAME( graphene::chain::dynamic_global_property_id_type ) FC_REFLECT_TYPENAME( graphene::chain::asset_dynamic_data_id_type ) diff --git a/libraries/chain/include/graphene/chain/sidechain_proposal_object.hpp b/libraries/chain/include/graphene/chain/sidechain_proposal_object.hpp new file mode 100644 index 00000000..456e941e --- /dev/null +++ b/libraries/chain/include/graphene/chain/sidechain_proposal_object.hpp @@ -0,0 +1,35 @@ +#pragma once + +#include +#include +#include + +namespace graphene { namespace chain { + +class sidechain_proposal_object : public abstract_object +{ + public: + static const uint8_t space_id = protocol_ids; + static const uint8_t type_id = sidechain_proposal_object_type; + + sidechain_proposal_id_type get_id()const { return id; } + + proposal_id_type proposal_id; + sidechain::sidechain_proposal_type proposal_type; +}; + +struct by_proposal; +struct by_type; +typedef boost::multi_index_container< + sidechain_proposal_object, + indexed_by< + ordered_unique< tag< by_id >, member< object, object_id_type, &object::id > >, + ordered_unique< tag< by_proposal >, member< sidechain_proposal_object, proposal_id_type, &sidechain_proposal_object::proposal_id > >, + ordered_non_unique< tag< by_type >, member< sidechain_proposal_object, sidechain::sidechain_proposal_type, &sidechain_proposal_object::proposal_type > > + > +> sidechain_multi_index_container; +typedef generic_index sidechain_proposal_index; + +} } // graphene::chain + +FC_REFLECT_DERIVED( graphene::chain::sidechain_proposal_object, (graphene::chain::object), (proposal_id)(proposal_type) ) diff --git a/libraries/sidechain/include/sidechain/types.hpp b/libraries/sidechain/include/sidechain/types.hpp index 16f0d8b0..501c2bff 100644 --- a/libraries/sidechain/include/sidechain/types.hpp +++ b/libraries/sidechain/include/sidechain/types.hpp @@ -25,6 +25,14 @@ enum class payment_type P2SH_WSH }; +enum class sidechain_proposal_type +{ + ISSUE_PBTC, + SEND_BTC_TRANSACTION, + WITHDRAW_PBTC, + RETURN_PBTC_BACK +}; + struct prev_out { std::string hash_tx; @@ -35,4 +43,5 @@ struct prev_out } FC_REFLECT_ENUM( sidechain::payment_type, (NULLDATA)(P2PK)(P2PKH)(P2SH)(P2WPKH)(P2WSH)(P2SH_WPKH)(P2SH_WSH) ); +FC_REFLECT_ENUM( sidechain::sidechain_proposal_type, (ISSUE_PBTC)(SEND_BTC_TRANSACTION)(WITHDRAW_PBTC)(RETURN_PBTC_BACK) ); FC_REFLECT( sidechain::prev_out, (hash_tx)(n_vout)(amount) );