Merge branch 'github_master'
# Conflicts: # libraries/fc
This commit is contained in:
commit
6b0804262a
23 changed files with 286 additions and 298 deletions
|
|
@ -145,6 +145,7 @@ endif( WIN32 )
|
|||
find_package( BerkeleyDB )
|
||||
|
||||
set(ENABLE_COVERAGE_TESTING FALSE CACHE BOOL "Build Graphene for code coverage analysis")
|
||||
|
||||
if(ENABLE_COVERAGE_TESTING)
|
||||
SET(CMAKE_CXX_FLAGS "--coverage ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
|
|
@ -168,7 +169,7 @@ set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
|
|||
|
||||
SET(CPACK_PACKAGE_DIRECTORY "${CMAKE_INSTALL_PREFIX}")
|
||||
set(CPACK_PACKAGE_NAME "graphene")
|
||||
set(CPACK_PACKAGE_VENDOR "Graphene Labs, Inc.")
|
||||
set(CPACK_PACKAGE_VENDOR "Cryptonomex, Inc.")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
|
||||
|
|
@ -188,7 +189,6 @@ if(WIN32)
|
|||
# it seems like windows zip files usually don't have a single directory inside them, unix tgz frequently do
|
||||
SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
|
||||
|
||||
include(CPack)
|
||||
endif(WIN32)
|
||||
|
||||
if(APPLE)
|
||||
|
|
@ -201,4 +201,5 @@ if(LINUX)
|
|||
SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 1)
|
||||
endif(LINUX)
|
||||
|
||||
include(CPack)
|
||||
endif(ENABLE_INSTALLER)
|
||||
|
|
|
|||
15
LICENSE
15
LICENSE
|
|
@ -1,15 +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.
|
||||
2
LICENSE.md
Normal file
2
LICENSE.md
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Copyright (c) 2015, Cryptonomex, Inc.
|
||||
All rights reserved.
|
||||
|
|
@ -411,6 +411,10 @@ namespace detail {
|
|||
}
|
||||
|
||||
return result;
|
||||
} catch ( const graphene::chain::unlinkable_block_exception& e ) {
|
||||
// translate to a graphene::net exception
|
||||
elog("Error when pushing block:\n${e}", ("e", e.to_detail_string()));
|
||||
FC_THROW_EXCEPTION(graphene::net::unlinkable_block_exception, "Error when pushing block:\n${e}", ("e", e.to_detail_string()));
|
||||
} catch( const fc::exception& e ) {
|
||||
elog("Error when pushing block:\n${e}", ("e", e.to_detail_string()));
|
||||
throw;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include <graphene/app/database_api.hpp>
|
||||
#include <graphene/chain/get_config.hpp>
|
||||
|
||||
#include <fc/bloom_filter.hpp>
|
||||
#include <fc/smart_ref_impl.hpp>
|
||||
|
|
@ -350,7 +351,7 @@ fc::variant_object database_api::get_config()const
|
|||
|
||||
fc::variant_object database_api_impl::get_config()const
|
||||
{
|
||||
return get_config();
|
||||
return graphene::chain::get_config();
|
||||
}
|
||||
|
||||
chain_id_type database_api::get_chain_id()const
|
||||
|
|
|
|||
|
|
@ -55,8 +55,6 @@ void account_statistics_object::process_fees(const account_object& a, database&
|
|||
{
|
||||
if( pending_fees > 0 || pending_vested_fees > 0 )
|
||||
{
|
||||
const auto& props = d.get_global_properties();
|
||||
|
||||
auto pay_out_fees = [&](const account_object& account, share_type core_fee_total, bool require_vesting)
|
||||
{
|
||||
// Check the referrer -- if he's no longer a member, pay to the lifetime referrer instead.
|
||||
|
|
@ -70,6 +68,8 @@ void account_statistics_object::process_fees(const account_object& a, database&
|
|||
assert( network_cut <= core_fee_total );
|
||||
|
||||
#ifndef NDEBUG
|
||||
const auto& props = d.get_global_properties();
|
||||
|
||||
share_type reserveed = cut_fee(network_cut, props.parameters.reserve_percent_of_fee);
|
||||
share_type accumulated = network_cut - reserveed;
|
||||
assert( accumulated + reserveed == network_cut );
|
||||
|
|
|
|||
|
|
@ -335,6 +335,7 @@ void_result asset_update_feed_producers_evaluator::do_evaluate(const asset_updat
|
|||
|
||||
FC_ASSERT(a.is_market_issued(), "Cannot update feed producers on a non-BitAsset.");
|
||||
FC_ASSERT(a.issuer != GRAPHENE_COMMITTEE_ACCOUNT, "Cannot set feed producers on a committee-issued asset.");
|
||||
FC_ASSERT(a.issuer != GRAPHENE_WITNESS_ACCOUNT, "Cannot set feed producers on a witness-issued asset.");
|
||||
|
||||
const asset_bitasset_data_object& b = a.bitasset_data(d);
|
||||
bitasset_to_update = &b;
|
||||
|
|
@ -457,12 +458,12 @@ void_result asset_publish_feeds_evaluator::do_evaluate(const asset_publish_feed_
|
|||
FC_ASSERT( !bitasset.has_settlement(), "No further feeds may be published after a settlement event" );
|
||||
FC_ASSERT(o.feed.settlement_price.quote.asset_id == bitasset.options.short_backing_asset);
|
||||
//Verify that the publisher is authoritative to publish a feed
|
||||
if( base.issuer == GRAPHENE_COMMITTEE_ACCOUNT )
|
||||
if( (base.issuer == GRAPHENE_WITNESS_ACCOUNT) || (base.issuer == GRAPHENE_COMMITTEE_ACCOUNT) )
|
||||
{
|
||||
FC_ASSERT( d.get(base.issuer).active.account_auths.count(o.publisher) );
|
||||
}
|
||||
else
|
||||
{
|
||||
//It's a committee_member-fed asset. Verify that publisher is an active committee_member or witness.
|
||||
FC_ASSERT(d.get(GRAPHENE_COMMITTEE_ACCOUNT).active.account_auths.count(o.publisher) ||
|
||||
d.get_global_properties().witness_accounts.count(o.publisher));
|
||||
} else {
|
||||
FC_ASSERT(bitasset.feeds.count(o.publisher));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ block_id_type block_database::fetch_block_id( uint32_t block_num )const
|
|||
index_entry e;
|
||||
auto index_pos = sizeof(e)*block_num;
|
||||
_block_num_to_pos.seekg( 0, _block_num_to_pos.end );
|
||||
if ( _block_num_to_pos.tellg() <= index_pos )
|
||||
if ( _block_num_to_pos.tellg() <= int64_t(index_pos) )
|
||||
FC_THROW_EXCEPTION(fc::key_not_found_exception, "Block number ${block_num} not contained in block database", ("block_num", block_num));
|
||||
|
||||
_block_num_to_pos.seekg( index_pos );
|
||||
|
|
|
|||
|
|
@ -27,5 +27,6 @@ namespace graphene { namespace net {
|
|||
FC_DECLARE_DERIVED_EXCEPTION( already_connected_to_requested_peer, graphene::net::net_exception, 90003, "already connected to requested peer" );
|
||||
FC_DECLARE_DERIVED_EXCEPTION( block_older_than_undo_history, graphene::net::net_exception, 90004, "block is older than our undo history allows us to process" );
|
||||
FC_DECLARE_DERIVED_EXCEPTION( peer_is_on_an_unreachable_fork, graphene::net::net_exception, 90005, "peer is on another fork" );
|
||||
FC_DECLARE_DERIVED_EXCEPTION( unlinkable_block_exception, graphene::net::net_exception, 90006, "unlinkable block" )
|
||||
|
||||
} }
|
||||
|
|
|
|||
|
|
@ -221,7 +221,6 @@ namespace graphene { namespace net
|
|||
bool we_need_sync_items_from_peer;
|
||||
fc::optional<boost::tuple<std::vector<item_hash_t>, fc::time_point> > item_ids_requested_from_peer; /// we check this to detect a timed-out request and in busy()
|
||||
item_to_time_map_type sync_items_requested_from_peer; /// ids of blocks we've requested from this peer during sync. fetch from another peer if this peer disconnects
|
||||
uint32_t last_block_number_delegate_has_seen; /// the number of the last block this peer has told us about that the delegate knows (ids_of_items_to_get[0] should be the id of block [this value + 1])
|
||||
item_hash_t last_block_delegate_has_seen; /// the hash of the last block this peer has told us about that the peer knows
|
||||
fc::time_point_sec last_block_time_delegate_has_seen;
|
||||
bool inhibit_fetching_sync_blocks;
|
||||
|
|
|
|||
|
|
@ -462,6 +462,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
> items_to_fetch_set_type;
|
||||
unsigned _items_to_fetch_sequence_counter;
|
||||
items_to_fetch_set_type _items_to_fetch; /// list of items we know another peer has and we want
|
||||
peer_connection::timestamped_items_set_type _recently_failed_items; /// list of transactions we've recently pushed and had rejected by the delegate
|
||||
// @}
|
||||
|
||||
/// used by the task that advertises inventory during normal operation
|
||||
|
|
@ -846,7 +847,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "unexpected exception on close ${e}", ("e", e.to_detail_string() ) );
|
||||
wlog( "unexpected exception on close ${e}", ("e", e) );
|
||||
}
|
||||
ilog( "done" );
|
||||
}
|
||||
|
|
@ -965,7 +966,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch (const fc::exception& e)
|
||||
{
|
||||
elog("${e}", ("e", e.to_detail_string()));
|
||||
elog("${e}", ("e", e));
|
||||
}
|
||||
}// while(!canceled)
|
||||
}
|
||||
|
|
@ -1293,10 +1294,21 @@ namespace graphene { namespace net { namespace detail {
|
|||
// timeout for any active peers is two block intervals
|
||||
uint32_t active_disconnect_timeout = 10 * current_block_interval_in_seconds;
|
||||
uint32_t active_send_keepalive_timeout = active_disconnect_timeout / 2;
|
||||
uint32_t active_ignored_request_timeout = current_block_interval_in_seconds;
|
||||
|
||||
// set the ignored request time out to 1 second. When we request a block
|
||||
// or transaction from a peer, this timeout determines how long we wait for them
|
||||
// to reply before we give up and ask another peer for the item.
|
||||
// Ideally this should be significantly shorter than the block interval, because
|
||||
// we'd like to realize the block isn't coming and fetch it from a different
|
||||
// peer before the next block comes in. At the current target of 3 second blocks,
|
||||
// 1 second seems reasonable. When we get closer to our eventual target of 1 second
|
||||
// blocks, this will need to be re-evaluated (i.e., can we set the timeout to 500ms
|
||||
// and still handle normal network & processing delays without excessive disconnects)
|
||||
fc::microseconds active_ignored_request_timeout = fc::seconds(1);
|
||||
|
||||
fc::time_point active_disconnect_threshold = fc::time_point::now() - fc::seconds(active_disconnect_timeout);
|
||||
fc::time_point active_send_keepalive_threshold = fc::time_point::now() - fc::seconds(active_send_keepalive_timeout);
|
||||
fc::time_point active_ignored_request_threshold = fc::time_point::now() - fc::seconds(active_ignored_request_timeout);
|
||||
fc::time_point active_ignored_request_threshold = fc::time_point::now() - active_ignored_request_timeout;
|
||||
for( const peer_connection_ptr& active_peer : _active_connections )
|
||||
{
|
||||
if( active_peer->connection_initiation_time < active_disconnect_threshold &&
|
||||
|
|
@ -1443,6 +1455,13 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
}
|
||||
|
||||
// this has nothing to do with updating the peer list, but we need to prune this list
|
||||
// at regular intervals, this is a fine place to do it.
|
||||
fc::time_point_sec oldest_failed_ids_to_keep(fc::time_point::now() - fc::minutes(15));
|
||||
auto oldest_failed_ids_to_keep_iter = _recently_failed_items.get<peer_connection::timestamp_index>().lower_bound(oldest_failed_ids_to_keep);
|
||||
auto begin_iter = _recently_failed_items.get<peer_connection::timestamp_index>().begin();
|
||||
_recently_failed_items.get<peer_connection::timestamp_index>().erase(begin_iter, oldest_failed_ids_to_keep_iter);
|
||||
|
||||
if (!_node_is_shutting_down && !_fetch_updated_peer_lists_loop_done.canceled() )
|
||||
_fetch_updated_peer_lists_loop_done = fc::schedule( [this](){ fetch_updated_peer_lists_loop(); },
|
||||
fc::time_point::now() + fc::minutes(15),
|
||||
|
|
@ -2276,14 +2295,14 @@ namespace graphene { namespace net { namespace detail {
|
|||
{
|
||||
VERIFY_CORRECT_THREAD();
|
||||
item_hash_t reference_point = peer->last_block_delegate_has_seen;
|
||||
uint32_t reference_point_block_num = peer->last_block_number_delegate_has_seen;
|
||||
uint32_t number_of_blocks_after_reference_point = (uint32_t)peer->ids_of_items_to_get.size();
|
||||
uint32_t reference_point_block_num = _delegate->get_block_number(peer->last_block_delegate_has_seen);
|
||||
|
||||
// when we call _delegate->get_blockchain_synopsis(), we may yield and there's a
|
||||
// chance this peer's state will change before we get control back. Save off
|
||||
// the stuff necessary for generating the synopsis.
|
||||
// This is pretty expensive, we should find a better way to do this
|
||||
std::unique_ptr<std::vector<item_hash_t> > original_ids_of_items_to_get(new std::vector<item_hash_t>(peer->ids_of_items_to_get.begin(), peer->ids_of_items_to_get.end()));
|
||||
std::vector<item_hash_t> original_ids_of_items_to_get(peer->ids_of_items_to_get.begin(), peer->ids_of_items_to_get.end());
|
||||
uint32_t number_of_blocks_after_reference_point = original_ids_of_items_to_get.size();
|
||||
|
||||
std::vector<item_hash_t> synopsis = _delegate->get_blockchain_synopsis(reference_point, number_of_blocks_after_reference_point);
|
||||
|
||||
|
|
@ -2303,7 +2322,8 @@ namespace graphene { namespace net { namespace detail {
|
|||
if( number_of_blocks_after_reference_point )
|
||||
{
|
||||
// then the synopsis is incomplete, add the missing elements from ids_of_items_to_get
|
||||
uint32_t true_high_block_num = reference_point_block_num + number_of_blocks_after_reference_point;
|
||||
uint32_t first_block_num_in_ids_to_get = _delegate->get_block_number(original_ids_of_items_to_get.front());
|
||||
uint32_t true_high_block_num = first_block_num_in_ids_to_get + original_ids_of_items_to_get.size() - 1;
|
||||
|
||||
// in order to generate a seamless synopsis, we need to be using the same low_block_num as the
|
||||
// backend code; the first block in the synopsis will be the low block number it used
|
||||
|
|
@ -2311,12 +2331,12 @@ namespace graphene { namespace net { namespace detail {
|
|||
|
||||
do
|
||||
{
|
||||
if( low_block_num > reference_point_block_num )
|
||||
synopsis.push_back((*original_ids_of_items_to_get)[low_block_num - reference_point_block_num - 1]);
|
||||
if( low_block_num >= first_block_num_in_ids_to_get )
|
||||
synopsis.push_back(original_ids_of_items_to_get[low_block_num - first_block_num_in_ids_to_get]);
|
||||
low_block_num += (true_high_block_num - low_block_num + 2 ) / 2;
|
||||
}
|
||||
while ( low_block_num <= true_high_block_num );
|
||||
assert(synopsis.back() == original_ids_of_items_to_get->back());
|
||||
assert(synopsis.back() == original_ids_of_items_to_get.back());
|
||||
}
|
||||
return synopsis;
|
||||
}
|
||||
|
|
@ -2327,7 +2347,6 @@ namespace graphene { namespace net { namespace detail {
|
|||
if( reset_fork_tracking_data_for_peer )
|
||||
{
|
||||
peer->last_block_delegate_has_seen = item_hash_t();
|
||||
peer->last_block_number_delegate_has_seen = 0;
|
||||
peer->last_block_time_delegate_has_seen = _delegate->get_block_time(item_hash_t());
|
||||
}
|
||||
|
||||
|
|
@ -2364,6 +2383,35 @@ namespace graphene { namespace net { namespace detail {
|
|||
// the blocks in the synopsis we sent
|
||||
if (!blockchain_item_ids_inventory_message_received.item_hashes_available.empty())
|
||||
{
|
||||
// what's more, it should be a sequential list of blocks, verify that first
|
||||
uint32_t first_block_number_in_reponse = _delegate->get_block_number(blockchain_item_ids_inventory_message_received.item_hashes_available.front());
|
||||
for (unsigned i = 1; i < blockchain_item_ids_inventory_message_received.item_hashes_available.size(); ++i)
|
||||
{
|
||||
uint32_t actual_num = _delegate->get_block_number(blockchain_item_ids_inventory_message_received.item_hashes_available[i]);
|
||||
uint32_t expected_num = first_block_number_in_reponse + i;
|
||||
if (actual_num != expected_num)
|
||||
{
|
||||
wlog("Invalid response from peer ${peer_endpoint}. The list of blocks they provided is not sequential, "
|
||||
"the ${position}th block in their reply was block number ${actual_num}, "
|
||||
"but it should have been number ${expected_num}",
|
||||
("peer_endpoint", originating_peer->get_remote_endpoint())
|
||||
("position", i)
|
||||
("actual_num", actual_num)
|
||||
("expected_num", expected_num));
|
||||
fc::exception error_for_peer(FC_LOG_MESSAGE(error,
|
||||
"You gave an invalid response to my request for sync blocks. The list of blocks you provided is not sequential, "
|
||||
"the ${position}th block in their reply was block number ${actual_num}, "
|
||||
"but it should have been number ${expected_num}",
|
||||
("position", i)
|
||||
("actual_num", actual_num)
|
||||
("expected_num", expected_num)));
|
||||
disconnect_from_peer(originating_peer,
|
||||
"You gave an invalid response to my request for sync blocks",
|
||||
true, error_for_peer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<item_hash_t>& synopsis_sent_in_request = originating_peer->item_ids_requested_from_peer->get<0>();
|
||||
const item_hash_t& first_item_hash = blockchain_item_ids_inventory_message_received.item_hashes_available.front();
|
||||
|
||||
|
|
@ -2376,15 +2424,12 @@ namespace graphene { namespace net { namespace detail {
|
|||
"but they provided a list of blocks starting with ${first_block}",
|
||||
("peer_endpoint", originating_peer->get_remote_endpoint())
|
||||
("first_block", first_item_hash));
|
||||
// TODO: enable these once committed
|
||||
//fc::exception error_for_peer(FC_LOG_MESSAGE(error, "You gave an invalid response for my request for sync blocks. I asked for blocks starting from the beginning of the chain, "
|
||||
// "but you returned a list of blocks starting with ${first_block}",
|
||||
// ("first_block", first_item_hash)));
|
||||
//disconnect_from_peer(originating_peer,
|
||||
// "You gave an invalid response to my request for sync blocks",
|
||||
// true, error_for_peer);
|
||||
fc::exception error_for_peer(FC_LOG_MESSAGE(error, "You gave an invalid response for my request for sync blocks. I asked for blocks starting from the beginning of the chain, "
|
||||
"but you returned a list of blocks starting with ${first_block}",
|
||||
("first_block", first_item_hash)));
|
||||
disconnect_from_peer(originating_peer,
|
||||
"You gave an invalid response to my request for sync blocks");
|
||||
"You gave an invalid response to my request for sync blocks",
|
||||
true, error_for_peer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2397,16 +2442,13 @@ namespace graphene { namespace net { namespace detail {
|
|||
("peer_endpoint", originating_peer->get_remote_endpoint())
|
||||
("synopsis", synopsis_sent_in_request)
|
||||
("first_block", first_item_hash));
|
||||
// TODO: enable these once committed
|
||||
//fc::exception error_for_peer(FC_LOG_MESSAGE(error, "You gave an invalid response for my request for sync blocks. I asked for blocks following something in "
|
||||
// "${synopsis}, but you returned a list of blocks starting with ${first_block} which wasn't one of your choices",
|
||||
// ("synopsis", synopsis_sent_in_request)
|
||||
// ("first_block", first_item_hash)));
|
||||
//disconnect_from_peer(originating_peer,
|
||||
// "You gave an invalid response to my request for sync blocks",
|
||||
// true, error_for_peer);
|
||||
fc::exception error_for_peer(FC_LOG_MESSAGE(error, "You gave an invalid response for my request for sync blocks. I asked for blocks following something in "
|
||||
"${synopsis}, but you returned a list of blocks starting with ${first_block} which wasn't one of your choices",
|
||||
("synopsis", synopsis_sent_in_request)
|
||||
("first_block", first_item_hash)));
|
||||
disconnect_from_peer(originating_peer,
|
||||
"You gave an invalid response to my request for sync blocks");
|
||||
"You gave an invalid response to my request for sync blocks",
|
||||
true, error_for_peer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2464,28 +2506,18 @@ namespace graphene { namespace net { namespace detail {
|
|||
("is_first", is_first_item_for_other_peer)("size", item_hashes_received.size()));
|
||||
if (!is_first_item_for_other_peer)
|
||||
{
|
||||
bool first = true;
|
||||
while (!item_hashes_received.empty() &&
|
||||
_delegate->has_item(item_id(blockchain_item_ids_inventory_message_received.item_type,
|
||||
item_hashes_received.front())))
|
||||
{
|
||||
assert(item_hashes_received.front() != item_hash_t());
|
||||
originating_peer->last_block_delegate_has_seen = item_hashes_received.front();
|
||||
if (first)
|
||||
{
|
||||
// we don't yet know the block number of the first block they sent, so look it up
|
||||
originating_peer->last_block_number_delegate_has_seen = _delegate->get_block_number(item_hashes_received.front());
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
++originating_peer->last_block_number_delegate_has_seen; // subsequent blocks will follow in immediate sequence
|
||||
originating_peer->last_block_time_delegate_has_seen = _delegate->get_block_time(item_hashes_received.front());
|
||||
dlog("popping item because delegate has already seen it. peer ${peer}'s last block the delegate has seen is now ${block_id} (actual block #${actual_block_num}, tracked block #${tracked_block_num})",
|
||||
dlog("popping item because delegate has already seen it. peer ${peer}'s last block the delegate has seen is now ${block_id} (actual block #${actual_block_num})",
|
||||
("peer", originating_peer->get_remote_endpoint())
|
||||
("block_id", originating_peer->last_block_delegate_has_seen)
|
||||
("actual_block_num", _delegate->get_block_number(item_hashes_received.front()))
|
||||
("tracked_block_num", originating_peer->last_block_number_delegate_has_seen));
|
||||
assert(originating_peer->last_block_number_delegate_has_seen == _delegate->get_block_number(originating_peer->last_block_delegate_has_seen));
|
||||
("actual_block_num", _delegate->get_block_number(item_hashes_received.front())));
|
||||
|
||||
item_hashes_received.pop_front();
|
||||
}
|
||||
dlog("after removing all items we have already seen, item_hashes_received.size() = ${size}", ("size", item_hashes_received.size()));
|
||||
|
|
@ -2520,7 +2552,6 @@ namespace graphene { namespace net { namespace detail {
|
|||
// blocks we sent in the initial synopsis.
|
||||
assert(_delegate->has_item(item_id(_sync_item_type, item_hashes_received.front())));
|
||||
originating_peer->last_block_delegate_has_seen = item_hashes_received.front();
|
||||
originating_peer->last_block_number_delegate_has_seen = _delegate->get_block_number(item_hashes_received.front());
|
||||
originating_peer->last_block_time_delegate_has_seen = _delegate->get_block_time(item_hashes_received.front());
|
||||
item_hashes_received.pop_front();
|
||||
}
|
||||
|
|
@ -2678,7 +2709,6 @@ namespace graphene { namespace net { namespace detail {
|
|||
{
|
||||
graphene::net::block_message block = last_block_message_sent->as<graphene::net::block_message>();
|
||||
originating_peer->last_block_delegate_has_seen = block.block_id;
|
||||
originating_peer->last_block_number_delegate_has_seen = _delegate->get_block_number(block.block_id);
|
||||
originating_peer->last_block_time_delegate_has_seen = _delegate->get_block_time(block.block_id);
|
||||
}
|
||||
|
||||
|
|
@ -2764,12 +2794,20 @@ namespace graphene { namespace net { namespace detail {
|
|||
originating_peer->inventory_peer_advertised_to_us.insert(peer_connection::timestamped_item_id(advertised_item_id, fc::time_point::now()));
|
||||
if (!we_requested_this_item_from_a_peer)
|
||||
{
|
||||
auto insert_result = _items_to_fetch.insert(prioritized_item_id(advertised_item_id, _items_to_fetch_sequence_counter++));
|
||||
if (insert_result.second)
|
||||
if (_recently_failed_items.find(item_id(item_ids_inventory_message_received.item_type, item_hash)) != _recently_failed_items.end())
|
||||
{
|
||||
dlog("adding item ${item_hash} from inventory message to our list of items to fetch",
|
||||
dlog("not adding ${item_hash} to our list of items to fetch because we've recently fetched a copy and it failed to push",
|
||||
("item_hash", item_hash));
|
||||
trigger_fetch_items_loop();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto insert_result = _items_to_fetch.insert(prioritized_item_id(advertised_item_id, _items_to_fetch_sequence_counter++));
|
||||
if (insert_result.second)
|
||||
{
|
||||
dlog("adding item ${item_hash} from inventory message to our list of items to fetch",
|
||||
("item_hash", item_hash));
|
||||
trigger_fetch_items_loop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2921,7 +2959,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
"allow us to switch to: ${e}",
|
||||
("num", block_message_to_send.block.block_num())
|
||||
("id", block_message_to_send.block_id)
|
||||
("e", e.to_detail_string()));
|
||||
("e", (fc::exception)e));
|
||||
handle_message_exception = e;
|
||||
discontinue_fetching_blocks_from_peer = true;
|
||||
}
|
||||
|
|
@ -3000,7 +3038,6 @@ namespace graphene { namespace net { namespace detail {
|
|||
if (items_being_processed_iter != peer->ids_of_items_being_processed.end())
|
||||
{
|
||||
peer->last_block_delegate_has_seen = block_message_to_send.block_id;
|
||||
peer->last_block_number_delegate_has_seen = block_message_to_send.block.block_num();
|
||||
peer->last_block_time_delegate_has_seen = block_message_to_send.block.timestamp;
|
||||
|
||||
peer->ids_of_items_being_processed.erase(items_being_processed_iter);
|
||||
|
|
@ -3209,10 +3246,10 @@ namespace graphene { namespace net { namespace detail {
|
|||
fc::time_point message_receive_time = fc::time_point::now();
|
||||
|
||||
dlog( "received a block from peer ${endpoint}, passing it to client", ("endpoint", originating_peer->get_remote_endpoint() ) );
|
||||
std::list<peer_connection_ptr> peers_to_disconnect;
|
||||
std::set<peer_connection_ptr> peers_to_disconnect;
|
||||
std::string disconnect_reason;
|
||||
fc::oexception disconnect_exception;
|
||||
|
||||
fc::oexception restart_sync_exception;
|
||||
try
|
||||
{
|
||||
// we can get into an intersting situation near the end of synchronization. We can be in
|
||||
|
|
@ -3229,8 +3266,8 @@ namespace graphene { namespace net { namespace detail {
|
|||
_delegate->handle_block(block_message_to_process, false, contained_transaction_message_ids);
|
||||
message_validated_time = fc::time_point::now();
|
||||
ilog("Successfully pushed block ${num} (id:${id})",
|
||||
("num", block_message_to_process.block.block_num())
|
||||
("id", block_message_to_process.block_id));
|
||||
("num", block_message_to_process.block.block_num())
|
||||
("id", block_message_to_process.block_id));
|
||||
_most_recent_blocks_accepted.push_back(block_message_to_process.block_id);
|
||||
|
||||
bool new_transaction_discovered = false;
|
||||
|
|
@ -3272,7 +3309,6 @@ namespace graphene { namespace net { namespace detail {
|
|||
// For now, it will remain there, which will prevent us from offering the peer this
|
||||
// block back when we rebroadcast the block below
|
||||
peer->last_block_delegate_has_seen = block_message_to_process.block_id;
|
||||
peer->last_block_number_delegate_has_seen = block_number;
|
||||
peer->last_block_time_delegate_has_seen = block_time;
|
||||
}
|
||||
peer->clear_old_inventory();
|
||||
|
|
@ -3293,7 +3329,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
if (next_fork_block_number != 0 &&
|
||||
next_fork_block_number <= block_number)
|
||||
{
|
||||
peers_to_disconnect.push_back(peer);
|
||||
peers_to_disconnect.insert(peer);
|
||||
#ifdef ENABLE_DEBUG_ULOGS
|
||||
ulog("Disconnecting from peer because their version is too old. Their version date: ${date}", ("date", peer->graphene_git_revision_unix_timestamp));
|
||||
#endif
|
||||
|
|
@ -3314,7 +3350,11 @@ namespace graphene { namespace net { namespace detail {
|
|||
{
|
||||
throw;
|
||||
}
|
||||
catch ( const fc::exception& e )
|
||||
catch (const unlinkable_block_exception& e)
|
||||
{
|
||||
restart_sync_exception = e;
|
||||
}
|
||||
catch (const fc::exception& e)
|
||||
{
|
||||
// client rejected the block. Disconnect the client and any other clients that offered us this block
|
||||
wlog("Failed to push block ${num} (id:${id}), client rejected block sent by peer",
|
||||
|
|
@ -3323,11 +3363,22 @@ namespace graphene { namespace net { namespace detail {
|
|||
|
||||
disconnect_exception = e;
|
||||
disconnect_reason = "You offered me a block that I have deemed to be invalid";
|
||||
|
||||
peers_to_disconnect.insert( originating_peer->shared_from_this() );
|
||||
for (const peer_connection_ptr& peer : _active_connections)
|
||||
if (!peer->ids_of_items_to_get.empty() &&
|
||||
peer->ids_of_items_to_get.front() == block_message_to_process.block_id)
|
||||
peers_to_disconnect.push_back(peer);
|
||||
if (!peer->ids_of_items_to_get.empty() && peer->ids_of_items_to_get.front() == block_message_to_process.block_id)
|
||||
peers_to_disconnect.insert(peer);
|
||||
}
|
||||
|
||||
if (restart_sync_exception)
|
||||
{
|
||||
wlog("Peer ${peer} sent me a block that didn't link to our blockchain. Restarting sync mode with them to get the missing block. "
|
||||
"Error pushing block was: ${e}",
|
||||
("peer", originating_peer->get_remote_endpoint())
|
||||
("e", *restart_sync_exception));
|
||||
start_synchronizing_with_peer(originating_peer->shared_from_this());
|
||||
}
|
||||
|
||||
for (const peer_connection_ptr& peer : peers_to_disconnect)
|
||||
{
|
||||
wlog("disconnecting client ${endpoint} because it offered us the rejected block", ("endpoint", peer->get_remote_endpoint()));
|
||||
|
|
@ -3633,7 +3684,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
user_data["user_agent"] = peer->user_agent;
|
||||
|
||||
user_data["last_known_block_hash"] = peer->last_block_delegate_has_seen;
|
||||
user_data["last_known_block_number"] = peer->last_block_number_delegate_has_seen;
|
||||
user_data["last_known_block_number"] = _delegate->get_block_number(peer->last_block_delegate_has_seen);
|
||||
user_data["last_known_block_time"] = peer->last_block_time_delegate_has_seen;
|
||||
|
||||
data_for_this_peer.user_data = user_data;
|
||||
|
|
@ -3661,7 +3712,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
fc::time_point message_receive_time = fc::time_point::now();
|
||||
|
||||
// only process it if we asked for it
|
||||
auto iter = originating_peer->items_requested_from_peer.find( item_id(message_to_process.msg_type, message_hash ) );
|
||||
auto iter = originating_peer->items_requested_from_peer.find( item_id(message_to_process.msg_type, message_hash) );
|
||||
if( iter == originating_peer->items_requested_from_peer.end() )
|
||||
{
|
||||
wlog( "received a message I didn't ask for from peer ${endpoint}, disconnecting from peer",
|
||||
|
|
@ -3682,7 +3733,11 @@ namespace graphene { namespace net { namespace detail {
|
|||
try
|
||||
{
|
||||
if (message_to_process.msg_type == trx_message_type)
|
||||
_delegate->handle_transaction( message_to_process.as<trx_message>() );
|
||||
{
|
||||
trx_message transaction_message_to_process = message_to_process.as<trx_message>();
|
||||
dlog("passing message containing transaction ${trx} to client", ("trx", transaction_message_to_process.trx.id()));
|
||||
_delegate->handle_transaction(transaction_message_to_process);
|
||||
}
|
||||
else
|
||||
_delegate->handle_message( message_to_process );
|
||||
message_validated_time = fc::time_point::now();
|
||||
|
|
@ -3701,7 +3756,9 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "client rejected message sent by peer ${peer}, ${e}", ("peer", originating_peer->get_remote_endpoint() )("e", e.to_string() ) );
|
||||
wlog( "client rejected message sent by peer ${peer}, ${e}", ("peer", originating_peer->get_remote_endpoint() )("e", e) );
|
||||
// record it so we don't try to fetch this item again
|
||||
_recently_failed_items.insert(peer_connection::timestamped_item_id(item_id(message_to_process.msg_type, message_hash ), fc::time_point::now()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3718,7 +3775,6 @@ namespace graphene { namespace net { namespace detail {
|
|||
peer->number_of_unfetched_item_ids = 0;
|
||||
peer->we_need_sync_items_from_peer = true;
|
||||
peer->last_block_delegate_has_seen = item_hash_t();
|
||||
peer->last_block_number_delegate_has_seen = 0;
|
||||
peer->last_block_time_delegate_has_seen = _delegate->get_block_time(item_hash_t());
|
||||
peer->inhibit_fetching_sync_blocks = false;
|
||||
fetch_next_batch_of_item_ids_from_peer( peer.get() );
|
||||
|
|
@ -3753,7 +3809,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while closing P2P peer database, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while closing P2P peer database, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -3768,7 +3824,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while closing P2P TCP server, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while closing P2P TCP server, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -3782,7 +3838,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while terminating P2P accept loop, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while terminating P2P accept loop, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -3804,7 +3860,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while terminating P2P connect loop, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while terminating P2P connect loop, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -3822,7 +3878,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while terminating Process backlog of sync items task, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while terminating Process backlog of sync items task, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -3844,7 +3900,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog("Exception thrown while terminating handle_message call #${count} task, ignoring: ${e}", ("e",e)("count", handle_message_call_count));
|
||||
wlog("Exception thrown while terminating handle_message call #${count} task, ignoring: ${e}", ("e", e)("count", handle_message_call_count));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -3867,7 +3923,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while terminating Fetch sync items loop, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while terminating Fetch sync items loop, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -3888,7 +3944,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while terminating Fetch items loop, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while terminating Fetch items loop, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -3909,7 +3965,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while terminating Advertise inventory loop, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while terminating Advertise inventory loop, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -3935,7 +3991,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while closing peer connection, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while closing peer connection, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -3960,7 +4016,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while terminating Delayed peer deletion task, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while terminating Delayed peer deletion task, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -3979,7 +4035,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while terminating Terminate inactive connections loop, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while terminating Terminate inactive connections loop, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -3993,7 +4049,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while terminating Fetch updated peer lists loop, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while terminating Fetch updated peer lists loop, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -4007,7 +4063,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while terminating Bandwidth monitor loop, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while terminating Bandwidth monitor loop, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -4021,7 +4077,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
wlog( "Exception thrown while terminating Dump node status task, ignoring: ${e}", ("e",e) );
|
||||
wlog( "Exception thrown while terminating Dump node status task, ignoring: ${e}", ("e", e) );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -4708,8 +4764,8 @@ namespace graphene { namespace net { namespace detail {
|
|||
// provide these for debugging
|
||||
// warning: these are just approximations, if the peer is "downstream" of us, they may
|
||||
// have received blocks from other peers that we are unaware of
|
||||
peer_details["current_head_block_number"] = peer->last_block_number_delegate_has_seen;
|
||||
peer_details["current_head_block"] = peer->last_block_delegate_has_seen;
|
||||
peer_details["current_head_block_number"] = _delegate->get_block_number(peer->last_block_delegate_has_seen);
|
||||
peer_details["current_head_block_time"] = peer->last_block_time_delegate_has_seen;
|
||||
|
||||
this_peer_status.info = peer_details;
|
||||
|
|
@ -5133,7 +5189,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
}
|
||||
catch ( const fc::exception& e )
|
||||
{
|
||||
elog( "${r}", ("r",e.to_detail_string() ) );
|
||||
elog( "${r}", ("r",e) );
|
||||
}
|
||||
destination_node->messages_to_deliver.pop();
|
||||
}
|
||||
|
|
@ -5308,8 +5364,11 @@ namespace graphene { namespace net { namespace detail {
|
|||
|
||||
uint32_t statistics_gathering_node_delegate_wrapper::get_block_number(const item_hash_t& block_id)
|
||||
{
|
||||
INVOKE_AND_COLLECT_STATISTICS(get_block_number, block_id);
|
||||
// this function doesn't need to block,
|
||||
ASSERT_TASK_NOT_PREEMPTED();
|
||||
return _node_delegate->get_block_number(block_id);
|
||||
}
|
||||
|
||||
fc::time_point_sec statistics_gathering_node_delegate_wrapper::get_block_time(const item_hash_t& block_id)
|
||||
{
|
||||
INVOKE_AND_COLLECT_STATISTICS(get_block_time, block_id);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ namespace graphene { namespace net
|
|||
number_of_unfetched_item_ids(0),
|
||||
peer_needs_sync_items_from_us(true),
|
||||
we_need_sync_items_from_peer(true),
|
||||
last_block_number_delegate_has_seen(0),
|
||||
inhibit_fetching_sync_blocks(false),
|
||||
transaction_fetching_inhibited_until(fc::time_point::min()),
|
||||
last_known_fork_block_number(0),
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ struct operation_process_fill_order
|
|||
|
||||
void operator()( const fill_order_operation& o )const
|
||||
{
|
||||
ilog( "processing ${o}", ("o",o) );
|
||||
//ilog( "processing ${o}", ("o",o) );
|
||||
const auto& buckets = _plugin.tracked_buckets();
|
||||
auto& db = _plugin.database();
|
||||
const auto& bucket_idx = db.get_index_type<bucket_index>();
|
||||
|
|
@ -94,7 +94,7 @@ struct operation_process_fill_order
|
|||
*/
|
||||
if( key.base > key.quote )
|
||||
{
|
||||
ilog( " skipping because base > quote" );
|
||||
//ilog( " skipping because base > quote" );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ struct operation_process_fill_order
|
|||
}
|
||||
else
|
||||
{ // update existing bucket
|
||||
wlog( " before updating bucket ${b}", ("b",*itr) );
|
||||
//wlog( " before updating bucket ${b}", ("b",*itr) );
|
||||
db.modify( *itr, [&]( bucket_object& b ){
|
||||
b.base_volume += trade_price.base.amount;
|
||||
b.quote_volume += trade_price.quote.amount;
|
||||
|
|
@ -141,7 +141,7 @@ struct operation_process_fill_order
|
|||
b.low_quote = b.close_quote;
|
||||
}
|
||||
});
|
||||
wlog( " after bucket bucket ${b}", ("b",*itr) );
|
||||
//wlog( " after bucket bucket ${b}", ("b",*itr) );
|
||||
}
|
||||
|
||||
if( max_history != 0 )
|
||||
|
|
@ -155,7 +155,7 @@ struct operation_process_fill_order
|
|||
itr->key.seconds == bucket &&
|
||||
itr->key.open < cutoff )
|
||||
{
|
||||
elog( " removing old bucket ${b}", ("b", *itr) );
|
||||
// elog( " removing old bucket ${b}", ("b", *itr) );
|
||||
auto old_itr = itr;
|
||||
++itr;
|
||||
db.remove( *old_itr );
|
||||
|
|
|
|||
|
|
@ -1,6 +1,31 @@
|
|||
cmake_minimum_required(VERSION 2.8.11)
|
||||
#cmake_minimum_required(VERSION 2.8.11)
|
||||
|
||||
#project(full_web_node)
|
||||
|
||||
|
||||
|
||||
# use, i.e. don't skip the full RPATH for the build tree
|
||||
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||
|
||||
# when building, don't use the install RPATH already
|
||||
# (but later on when installing)
|
||||
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
|
||||
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
|
||||
# add the automatically determined parts of the RPATH
|
||||
# which point to directories outside the build tree to the install RPATH
|
||||
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
|
||||
# the RPATH to be used when installing, but only if it's not a system directory
|
||||
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
|
||||
IF("${isSystemDir}" STREQUAL "-1")
|
||||
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
ENDIF("${isSystemDir}" STREQUAL "-1")
|
||||
|
||||
|
||||
|
||||
project(full_web_node)
|
||||
|
||||
# Find includes in corresponding build directories
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
|
@ -16,14 +41,77 @@ file(GLOB WEB web/*)
|
|||
qt5_add_resources(QML_QRC qml/qml.qrc)
|
||||
qt5_add_resources(WEB_QRC web/web.qrc)
|
||||
|
||||
add_executable(full_web_node BlockChain.cpp main.cpp ${QML_QRC} ${WEB_QRC} ${QML})
|
||||
|
||||
target_link_libraries(full_web_node PRIVATE Qt5::Core Qt5::Quick Qt5::WebEngine
|
||||
set( APP_NAME "GrapheneTest3" )
|
||||
|
||||
set( CPACK_BUNDLE_NAME ${APP_NAME} )
|
||||
set( CPACK_PACKAGE_NAME ${CPACK_BUNDLE_NAME} )
|
||||
set( CPACK_PACKAGE_EXECUTABLES qt_wallet ${CPACK_BUNDLE_NAME} )
|
||||
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "package description summary" )
|
||||
set( CPACK_PACKAGE_VENDOR "BitShares" )
|
||||
set( CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR} )
|
||||
set( CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR} )
|
||||
set( CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH} )
|
||||
set( CPACK_DMG_VOLUME_NAME ${CPACK_BUNDLE_NAME} )
|
||||
set( CPACK_PACKAGE_FILE_NAME ${CPACK_BUNDLE_NAME} )
|
||||
get_filename_component( QT_PATH ${Qt5Core_DIR}/../../../ ABSOLUTE )
|
||||
|
||||
|
||||
|
||||
IF( APPLE )
|
||||
set ( OSX_ICON_FILE "${CMAKE_CURRENT_SOURCE_DIR}/images/bitshares.icns" )
|
||||
SET_SOURCE_FILES_PROPERTIES( "${OSX_ICON_FILE}" PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
|
||||
SET( MACOSX_BUNDLE_BUNDLE_NAME ${CPACK_BUNDLE_NAME} )
|
||||
SET( MACOSX_BUNDLE_EXECUTABLE_NAME ${CPACK_BUNDLE_NAME} )
|
||||
SET( MACOSX_BUNDLE_GUI_IDENTIFIER "org.cryptonomex.${CPACK_BUNDLE_NAME}" )
|
||||
SET( MACOSX_BUNDLE_ICON_FILE "bitshares.icns" )
|
||||
SET( MACOSX_BUNDLE_INFO_STRING "Graphene v${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
|
||||
SET( MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
|
||||
SET( MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
|
||||
SET( MACOSX_BUNDLE_BUNDLE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
|
||||
SET( MACOSX_BUNDLE_COPYRIGHT "(C) 2014 Cryptonomex" )
|
||||
# SET( MACOSX_BUNDLE_URL_HANDLER_NAME "${MACOSX_BUNDLE_GUI_IDENTIFIER}" )
|
||||
# SET( MACOSX_BUNDLE_URL_HANDLER_SCHEME "${CUSTOM_URL_SCHEME}" )
|
||||
# set_source_files_properties("images/bitshares.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
ENDIF()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
add_executable( ${APP_NAME} WIN32 MACOSX_BUNDLE BlockChain.cpp main.cpp ${QML_QRC} ${WEB_QRC} ${QML})
|
||||
|
||||
target_link_libraries(${APP_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::WebEngine
|
||||
graphene_chain graphene_egenesis_full graphene_utilities fc graphene_account_history graphene_market_history graphene_app )
|
||||
|
||||
install( TARGETS
|
||||
full_web_node
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
|
||||
#install( TARGETS
|
||||
# ${APP_NAME}
|
||||
# RUNTIME DESTINATION bin
|
||||
# LIBRARY DESTINATION lib
|
||||
# ARCHIVE DESTINATION lib
|
||||
#)
|
||||
|
||||
|
||||
ADD_CUSTOM_COMMAND(TARGET ${APP_NAME} POST_BUILD ${POST_BUILD_STEP_COMMANDS}
|
||||
COMMENT "Copying binaries and other files into target directory."
|
||||
)
|
||||
|
||||
ADD_CUSTOM_COMMAND(TARGET ${APP_NAME} PRE_BUILD ${PRE_BUILD_STEP_COMMANDS}
|
||||
COMMENT "Copying static resource files to build directory."
|
||||
)
|
||||
|
||||
include( DeployQt4 )
|
||||
include( InstallRequiredSystemLibraries )
|
||||
install( TARGETS ${APP_NAME} DESTINATION "." )
|
||||
|
||||
IF( APPLE )
|
||||
set( CPACK_GENERATOR "DragNDrop" )
|
||||
include( CPack )
|
||||
set( PLUGINS "")
|
||||
list( APPEND PLUGINS "${QT_PATH}/plugins/platforms/libqcocoa.dylib" )
|
||||
list( APPEND PLUGINS "${QT_PATH}/plugins/imageformats/libqjpeg.dylib" )
|
||||
install_qt4_executable( ${APP_NAME}.app "${PLUGINS}" )
|
||||
ENDIF()
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -37,7 +37,7 @@ int main( int argc, char** argv )
|
|||
try
|
||||
{
|
||||
std::string dev_key_prefix;
|
||||
bool need_help;
|
||||
bool need_help = false;
|
||||
if( argc < 2 )
|
||||
need_help = true;
|
||||
else
|
||||
|
|
@ -51,6 +51,7 @@ int main( int argc, char** argv )
|
|||
|
||||
if( need_help )
|
||||
{
|
||||
std::cerr << argc << " " << argv[1] << "\n";
|
||||
std::cerr << "get-dev-key <prefix> <suffix> ...\n"
|
||||
"\n"
|
||||
"example:\n"
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ const account_object& database_fixture::get_account( const string& name )const
|
|||
|
||||
const asset_object& database_fixture::create_bitasset(
|
||||
const string& name,
|
||||
account_id_type issuer /* = 1 */,
|
||||
account_id_type issuer /* = GRAPHENE_WITNESS_ACCOUNT */,
|
||||
uint16_t market_fee_percent /* = 100 */ /* 1% */,
|
||||
uint16_t flags /* = charge_market_fee */
|
||||
)
|
||||
|
|
@ -438,7 +438,7 @@ const asset_object& database_fixture::create_bitasset(
|
|||
|
||||
const asset_object& database_fixture::create_prediction_market(
|
||||
const string& name,
|
||||
account_id_type issuer /* = 1 */,
|
||||
account_id_type issuer /* = GRAPHENE_WITNESS_ACCOUNT */,
|
||||
uint16_t market_fee_percent /* = 100 */ /* 1% */,
|
||||
uint16_t flags /* = charge_market_fee */
|
||||
)
|
||||
|
|
|
|||
|
|
@ -210,11 +210,11 @@ struct database_fixture {
|
|||
const asset_object& get_asset( const string& symbol )const;
|
||||
const account_object& get_account( const string& name )const;
|
||||
const asset_object& create_bitasset(const string& name,
|
||||
account_id_type issuer = account_id_type(1),
|
||||
account_id_type issuer = GRAPHENE_WITNESS_ACCOUNT,
|
||||
uint16_t market_fee_percent = 100 /*1%*/,
|
||||
uint16_t flags = charge_market_fee);
|
||||
const asset_object& create_prediction_market(const string& name,
|
||||
account_id_type issuer = account_id_type(1),
|
||||
account_id_type issuer = GRAPHENE_WITNESS_ACCOUNT,
|
||||
uint16_t market_fee_percent = 100 /*1%*/,
|
||||
uint16_t flags = charge_market_fee);
|
||||
const asset_object& create_user_issued_asset( const string& name );
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ BOOST_AUTO_TEST_CASE( generate_empty_blocks )
|
|||
for( uint32_t i = 1; i < 200+GRAPHENE_MIN_UNDO_HISTORY+1; ++i )
|
||||
{
|
||||
BOOST_CHECK( db.head_block_id() == b.id() );
|
||||
witness_id_type prev_witness = b.witness;
|
||||
//witness_id_type prev_witness = b.witness;
|
||||
witness_id_type cur_witness = db.get_scheduled_witness(1);
|
||||
//BOOST_CHECK( cur_witness != prev_witness );
|
||||
b = db.generate_block(db.get_slot_time(1), cur_witness, init_account_priv_key, database::skip_nothing);
|
||||
|
|
@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE( generate_empty_blocks )
|
|||
for( uint32_t i = 0; i < 200; ++i )
|
||||
{
|
||||
BOOST_CHECK( db.head_block_id() == b.id() );
|
||||
witness_id_type prev_witness = b.witness;
|
||||
//witness_id_type prev_witness = b.witness;
|
||||
witness_id_type cur_witness = db.get_scheduled_witness(1);
|
||||
//BOOST_CHECK( cur_witness != prev_witness );
|
||||
b = db.generate_block(db.get_slot_time(1), cur_witness, init_account_priv_key, database::skip_nothing);
|
||||
|
|
@ -1029,24 +1029,20 @@ BOOST_FIXTURE_TEST_CASE( rsf_missed_blocks, database_fixture )
|
|||
FC_LOG_AND_RETHROW()
|
||||
}
|
||||
|
||||
/** Disabled until it can be reimplemented
|
||||
BOOST_FIXTURE_TEST_CASE( transaction_invalidated_in_cache, database_fixture )
|
||||
{
|
||||
try
|
||||
{
|
||||
ACTORS( (alice)(bob) );
|
||||
|
||||
auto generate_block = [&]( database& d ) -> signed_block
|
||||
auto generate_block = [&]( database& d, uint32_t skip = database::skip_nothing ) -> signed_block
|
||||
{
|
||||
return d.generate_block(d.get_slot_time(1), d.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
|
||||
return d.generate_block(d.get_slot_time(1), d.get_scheduled_witness(1), init_account_priv_key, skip);
|
||||
};
|
||||
|
||||
wdump( (db.fetch_block_by_number(1)) );
|
||||
wdump( (db.fetch_block_by_id( db.head_block_id() ) ) );
|
||||
|
||||
signed_block b1 = generate_block(db);
|
||||
wdump( (db.fetch_block_by_number(1)) );
|
||||
wdump( (db.fetch_block_by_id( db.head_block_id() ) ) );
|
||||
// tx's created by ACTORS() have bogus authority, so we need to
|
||||
// skip_authority_check in the block where they're included
|
||||
signed_block b1 = generate_block(db, database::skip_authority_check);
|
||||
|
||||
fc::temp_directory data_dir2( graphene::utilities::temp_directory_path() );
|
||||
|
||||
|
|
@ -1056,18 +1052,17 @@ BOOST_FIXTURE_TEST_CASE( transaction_invalidated_in_cache, database_fixture )
|
|||
|
||||
while( db2.head_block_num() < db.head_block_num() )
|
||||
{
|
||||
wdump( (db.head_block_num()) (db2.head_block_num()) );
|
||||
optional< signed_block > b = db.fetch_block_by_number( db2.head_block_num()+1 );
|
||||
db2.push_block(*b, database::skip_witness_signature);
|
||||
}
|
||||
wlog("caught up db2 to db");
|
||||
BOOST_CHECK( db2.get( alice_id ).name == "alice" );
|
||||
BOOST_CHECK( db2.get( bob_id ).name == "bob" );
|
||||
|
||||
db2.push_block(generate_block(db));
|
||||
transfer( account_id_type(), alice_id, asset( 1000 ) );
|
||||
transfer( account_id_type(), bob_id, asset( 1000 ) );
|
||||
db2.push_block(generate_block(db));
|
||||
// need to skip authority check here as well for same reason as above
|
||||
db2.push_block(generate_block(db, database::skip_authority_check), database::skip_authority_check);
|
||||
|
||||
BOOST_CHECK_EQUAL(db.get_balance(alice_id, asset_id_type()).amount.value, 1000);
|
||||
BOOST_CHECK_EQUAL(db.get_balance( bob_id, asset_id_type()).amount.value, 1000);
|
||||
|
|
@ -1134,7 +1129,7 @@ BOOST_FIXTURE_TEST_CASE( transaction_invalidated_in_cache, database_fixture )
|
|||
// This needs to occur while switching to a fork.
|
||||
//
|
||||
|
||||
signed_transaction tx_a = generate_xfer_tx( bob_id, alice_id, 1000, 3 );
|
||||
signed_transaction tx_a = generate_xfer_tx( bob_id, alice_id, 1000, 2 );
|
||||
signed_transaction tx_b = generate_xfer_tx( alice_id, bob_id, 2000, 10 );
|
||||
signed_transaction tx_c = generate_xfer_tx( alice_id, bob_id, 500, 10 );
|
||||
|
||||
|
|
@ -1182,7 +1177,6 @@ BOOST_FIXTURE_TEST_CASE( transaction_invalidated_in_cache, database_fixture )
|
|||
throw;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
BOOST_AUTO_TEST_CASE( genesis_reserve_ids )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE( call_order_update_test )
|
|||
{
|
||||
try {
|
||||
ACTORS((dan)(sam));
|
||||
const auto& bitusd = create_bitasset("BITUSD");
|
||||
const auto& bitusd = create_bitasset("BITUSD", sam.id);
|
||||
const auto& core = asset_id_type()(db);
|
||||
|
||||
transfer(committee_account, dan_id, asset(10000000));
|
||||
|
|
@ -160,7 +160,7 @@ BOOST_AUTO_TEST_CASE( margin_call_limit_test )
|
|||
{ try {
|
||||
ACTORS((buyer)(seller)(borrower)(borrower2)(feedproducer));
|
||||
|
||||
const auto& bitusd = create_bitasset("BITUSD");
|
||||
const auto& bitusd = create_bitasset("BITUSD", feedproducer_id);
|
||||
const auto& core = asset_id_type()(db);
|
||||
|
||||
int64_t init_balance(1000000);
|
||||
|
|
@ -219,7 +219,7 @@ BOOST_AUTO_TEST_CASE( black_swan )
|
|||
{ try {
|
||||
ACTORS((buyer)(seller)(borrower)(borrower2)(feedproducer));
|
||||
|
||||
const auto& bitusd = create_bitasset("BITUSD");
|
||||
const auto& bitusd = create_bitasset("BITUSD", feedproducer_id);
|
||||
const auto& core = asset_id_type()(db);
|
||||
|
||||
int64_t init_balance(1000000);
|
||||
|
|
@ -1251,7 +1251,7 @@ BOOST_AUTO_TEST_CASE( reserve_asset_test )
|
|||
try
|
||||
{
|
||||
ACTORS((alice)(bob)(sam)(judge));
|
||||
const auto& basset = create_bitasset("BITUSD");
|
||||
const auto& basset = create_bitasset("BITUSD", judge_id);
|
||||
const auto& uasset = create_user_issued_asset("TEST");
|
||||
const auto& passet = create_prediction_market("PMARK", judge_id);
|
||||
const auto& casset = asset_id_type()(db);
|
||||
|
|
@ -1336,7 +1336,7 @@ BOOST_AUTO_TEST_CASE( cover_with_collateral_test )
|
|||
try
|
||||
{
|
||||
ACTORS((alice)(bob)(sam));
|
||||
const auto& bitusd = create_bitasset("BITUSD");
|
||||
const auto& bitusd = create_bitasset("BITUSD", sam_id);
|
||||
const auto& core = asset_id_type()(db);
|
||||
|
||||
BOOST_TEST_MESSAGE( "Setting price feed to $0.02 / 100" );
|
||||
|
|
|
|||
Loading…
Reference in a new issue