Commit a0655d85 authored by Mariusz's avatar Mariusz
Browse files

Final fix in p2p-plugin

parent e9f7dec3
......@@ -74,6 +74,7 @@ namespace graphene { namespace net {
The simplest solution is softening a condition regarding 'chain_id'( see usage in 'node_impl::on_hello_message' method ).
*/
virtual hive::protocol::chain_id_type get_old_chain_id() const = 0;
virtual hive::protocol::chain_id_type get_new_chain_id() const = 0;
virtual hive::protocol::chain_id_type get_chain_id() const = 0;
......
......@@ -353,6 +353,7 @@ namespace graphene { namespace net {
fc::variant_object get_call_statistics();
hive::protocol::chain_id_type get_old_chain_id() const override;
hive::protocol::chain_id_type get_new_chain_id() const override;
hive::protocol::chain_id_type get_chain_id() const override;
bool has_item( const net::item_id& id ) override;
......@@ -2011,10 +2012,10 @@ namespace graphene { namespace net {
}
}
if ( !originating_peer->chain_id ||
( ( *originating_peer->chain_id != _delegate->get_chain_id() ) && ( *originating_peer->chain_id != _delegate->get_new_chain_id() ) ) )
( ( *originating_peer->chain_id != _delegate->get_old_chain_id() ) && ( *originating_peer->chain_id != _delegate->get_new_chain_id() ) ) )
{
wlog("Received hello message from peer running a node for different blockchain. My chain-id: '${my_chain_id}'. New chain-id: '${new_chain_id}'. Their chain-id: '${their_chain_id}'.",
("my_chain_id", _delegate->get_chain_id())("new_chain_id", _delegate->get_new_chain_id())("their_chain_id", originating_peer->chain_id) );
wlog("Received hello message from peer running a node for different blockchain. Old chain-id: '${old_chain_id}'. New chain-id: '${new_chain_id}'. Their chain-id: '${their_chain_id}'.",
("old_chain_id", _delegate->get_old_chain_id())("new_chain_id", _delegate->get_new_chain_id())("their_chain_id", originating_peer->chain_id) );
std::ostringstream rejection_message;
rejection_message << "Your client is running a different chain id";
......@@ -5592,6 +5593,11 @@ namespace graphene { namespace net {
*/
#endif
hive::protocol::chain_id_type statistics_gathering_node_delegate_wrapper::get_old_chain_id() const
{
INVOKE_AND_COLLECT_STATISTICS(get_old_chain_id);
}
hive::protocol::chain_id_type statistics_gathering_node_delegate_wrapper::get_new_chain_id() const
{
INVOKE_AND_COLLECT_STATISTICS(get_new_chain_id);
......
......@@ -91,6 +91,7 @@ public:
}
bool is_included_block(const block_id_type& block_id);
virtual hive::protocol::chain_id_type get_old_chain_id() const override;
virtual hive::protocol::chain_id_type get_new_chain_id() const override;
virtual hive::protocol::chain_id_type get_chain_id() const override;
......@@ -389,6 +390,11 @@ graphene::net::message p2p_plugin_impl::get_item( const graphene::net::item_id&
});
} FC_CAPTURE_AND_RETHROW( (id) ) }
hive::protocol::chain_id_type p2p_plugin_impl::get_old_chain_id() const
{
return STEEM_CHAIN_ID;
}
hive::protocol::chain_id_type p2p_plugin_impl::get_new_chain_id() const
{
return HIVE_CHAIN_ID;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment