Get rid of chain ID global, move chain_id_type to types.hpp
This commit is contained in:
parent
2e9876b557
commit
2d1e76aed0
15 changed files with 19 additions and 103 deletions
|
|
@ -20,13 +20,15 @@
|
||||||
#include <graphene/app/application.hpp>
|
#include <graphene/app/application.hpp>
|
||||||
#include <graphene/app/plugin.hpp>
|
#include <graphene/app/plugin.hpp>
|
||||||
|
|
||||||
|
#include <graphene/chain/protocol/fee_schedule.hpp>
|
||||||
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
|
|
||||||
#include <graphene/net/core_messages.hpp>
|
#include <graphene/net/core_messages.hpp>
|
||||||
|
|
||||||
#include <graphene/time/time.hpp>
|
#include <graphene/time/time.hpp>
|
||||||
|
|
||||||
#include <graphene/utilities/key_conversion.hpp>
|
#include <graphene/utilities/key_conversion.hpp>
|
||||||
#include <graphene/chain/protocol/chain_id.hpp>
|
|
||||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
|
||||||
#include <fc/smart_ref_impl.hpp>
|
#include <fc/smart_ref_impl.hpp>
|
||||||
|
|
||||||
#include <fc/rpc/api_connection.hpp>
|
#include <fc/rpc/api_connection.hpp>
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,13 @@
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <graphene/chain/protocol/chain_id.hpp>
|
|
||||||
|
#include <graphene/app/full_account.hpp>
|
||||||
|
|
||||||
#include <graphene/chain/protocol/types.hpp>
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
|
|
||||||
#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/operation_history_object.hpp>
|
#include <graphene/chain/operation_history_object.hpp>
|
||||||
#include <graphene/chain/asset_object.hpp>
|
#include <graphene/chain/asset_object.hpp>
|
||||||
|
|
@ -27,11 +31,12 @@
|
||||||
#include <graphene/chain/witness_object.hpp>
|
#include <graphene/chain/witness_object.hpp>
|
||||||
#include <graphene/chain/proposal_object.hpp>
|
#include <graphene/chain/proposal_object.hpp>
|
||||||
#include <graphene/chain/balance_object.hpp>
|
#include <graphene/chain/balance_object.hpp>
|
||||||
|
|
||||||
#include <graphene/chain/confidential_evaluator.hpp>
|
#include <graphene/chain/confidential_evaluator.hpp>
|
||||||
#include <graphene/net/node.hpp>
|
|
||||||
|
|
||||||
#include <graphene/market_history/market_history_plugin.hpp>
|
#include <graphene/market_history/market_history_plugin.hpp>
|
||||||
#include <graphene/app/full_account.hpp>
|
|
||||||
|
#include <graphene/net/node.hpp>
|
||||||
|
|
||||||
#include <fc/api.hpp>
|
#include <fc/api.hpp>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ add_library( graphene_chain
|
||||||
# db_witness_schedule.cpp
|
# db_witness_schedule.cpp
|
||||||
|
|
||||||
protocol/types.cpp
|
protocol/types.cpp
|
||||||
protocol/chain_id.cpp
|
|
||||||
protocol/address.cpp
|
protocol/address.cpp
|
||||||
protocol/authority.cpp
|
protocol/authority.cpp
|
||||||
protocol/asset.cpp
|
protocol/asset.cpp
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <graphene/chain/protocol/chain_parameters.hpp>
|
#include <graphene/chain/protocol/chain_parameters.hpp>
|
||||||
#include <graphene/chain/protocol/chain_id.hpp>
|
|
||||||
#include <graphene/chain/protocol/types.hpp>
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
|
|
||||||
#include <fc/crypto/sha256.hpp>
|
#include <fc/crypto/sha256.hpp>
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fc/uint128.hpp>
|
#include <fc/uint128.hpp>
|
||||||
|
|
||||||
#include <graphene/chain/protocol/chain_id.hpp>
|
|
||||||
#include <graphene/chain/protocol/chain_parameters.hpp>
|
#include <graphene/chain/protocol/chain_parameters.hpp>
|
||||||
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
#include <graphene/chain/database.hpp>
|
#include <graphene/chain/database.hpp>
|
||||||
#include <graphene/db/object.hpp>
|
#include <graphene/db/object.hpp>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 <fc/optional.hpp>
|
|
||||||
#include <fc/crypto/sha256.hpp>
|
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
|
||||||
|
|
||||||
typedef fc::sha256 chain_id_type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current chain ID. The chain ID is stored in a global
|
|
||||||
* variable. Accessing multiple Graphene-based chains from a single
|
|
||||||
* process is not supported. Returns the last chain ID set with
|
|
||||||
* set_current_chain_id(), or an invalid optional if never set.
|
|
||||||
*/
|
|
||||||
fc::optional<chain_id_type> get_current_chain_id();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the global chain ID. The chain ID is stored in a global
|
|
||||||
* variable. Accessing multiple Graphene-based chains from a single
|
|
||||||
* process is not supported.
|
|
||||||
*/
|
|
||||||
void set_current_chain_id( const fc::optional<chain_id_type>& chain_id );
|
|
||||||
|
|
||||||
} }
|
|
||||||
|
|
@ -16,8 +16,8 @@
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <graphene/chain/protocol/chain_id.hpp>
|
|
||||||
#include <graphene/chain/protocol/operations.hpp>
|
#include <graphene/chain/protocol/operations.hpp>
|
||||||
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ namespace graphene { namespace chain {
|
||||||
struct void_t{};
|
struct void_t{};
|
||||||
|
|
||||||
typedef fc::ecc::private_key private_key_type;
|
typedef fc::ecc::private_key private_key_type;
|
||||||
|
typedef fc::sha256 chain_id_type;
|
||||||
|
|
||||||
enum asset_issuer_permission_flags
|
enum asset_issuer_permission_flags
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fc/crypto/sha256.hpp>
|
|
||||||
#include <graphene/chain/protocol/chain_id.hpp>
|
|
||||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
|
||||||
#include <graphene/chain/genesis_state.hpp>
|
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
|
||||||
|
|
||||||
chain_id_type the_chain_id;
|
|
||||||
bool the_chain_id_initialized = false;
|
|
||||||
|
|
||||||
fc::optional< chain_id_type > get_current_chain_id()
|
|
||||||
{
|
|
||||||
optional< chain_id_type > result;
|
|
||||||
if( the_chain_id_initialized )
|
|
||||||
result = the_chain_id;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_current_chain_id( const fc::optional<chain_id_type>& chain_id )
|
|
||||||
{
|
|
||||||
bool valid = chain_id.valid();
|
|
||||||
the_chain_id_initialized = valid;
|
|
||||||
if( valid )
|
|
||||||
the_chain_id = *chain_id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
} } // graphene::chain
|
|
||||||
|
|
@ -17,7 +17,7 @@ ${generated_file_banner}
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <graphene/chain/protocol/chain_id.hpp>
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
#include <graphene/egenesis/egenesis.hpp>
|
#include <graphene/egenesis/egenesis.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace egenesis {
|
namespace graphene { namespace egenesis {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ ${generated_file_banner}
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <graphene/chain/protocol/chain_id.hpp>
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
#include <graphene/egenesis/egenesis.hpp>
|
#include <graphene/egenesis/egenesis.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace egenesis {
|
namespace graphene { namespace egenesis {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <graphene/chain/protocol/chain_id.hpp>
|
|
||||||
#include <graphene/egenesis/egenesis.hpp>
|
#include <graphene/egenesis/egenesis.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace egenesis {
|
namespace graphene { namespace egenesis {
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@
|
||||||
#include <fc/string.hpp>
|
#include <fc/string.hpp>
|
||||||
#include <fc/io/fstream.hpp>
|
#include <fc/io/fstream.hpp>
|
||||||
#include <fc/io/json.hpp>
|
#include <fc/io/json.hpp>
|
||||||
#include <graphene/chain/protocol/chain_id.hpp>
|
|
||||||
#include <graphene/chain/genesis_state.hpp>
|
#include <graphene/chain/genesis_state.hpp>
|
||||||
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
|
|
||||||
// we need to include the world in order to serialize fee_parameters
|
// we need to include the world in order to serialize fee_parameters
|
||||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
#include <graphene/chain/protocol/fee_schedule.hpp>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <fc/crypto/sha256.hpp>
|
#include <fc/crypto/sha256.hpp>
|
||||||
#include <graphene/chain/protocol/chain_id.hpp>
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
#include <graphene/chain/genesis_state.hpp>
|
#include <graphene/chain/genesis_state.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace egenesis {
|
namespace graphene { namespace egenesis {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
#include <graphene/net/message.hpp>
|
#include <graphene/net/message.hpp>
|
||||||
#include <graphene/net/peer_database.hpp>
|
#include <graphene/net/peer_database.hpp>
|
||||||
|
|
||||||
#include <graphene/chain/protocol/chain_id.hpp>
|
|
||||||
#include <graphene/chain/protocol/types.hpp>
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue