Define GRAPHENE_MIN_BLOCK_INTERVAL and use it to fix minimum_time_of_last_offered_block logic #154
This commit is contained in:
parent
a05d88b044
commit
e201e59b3d
5 changed files with 4 additions and 4 deletions
|
|
@ -38,6 +38,7 @@
|
||||||
* make the network unable to operate.
|
* make the network unable to operate.
|
||||||
*/
|
*/
|
||||||
#define GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT 1024
|
#define GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT 1024
|
||||||
|
#define GRAPHENE_MIN_BLOCK_INTERVAL 1 /* seconds */
|
||||||
#define GRAPHENE_MAX_BLOCK_INTERVAL 30 /* seconds */
|
#define GRAPHENE_MAX_BLOCK_INTERVAL 30 /* seconds */
|
||||||
|
|
||||||
#define GRAPHENE_DEFAULT_BLOCK_INTERVAL 5 /* seconds */
|
#define GRAPHENE_DEFAULT_BLOCK_INTERVAL 5 /* seconds */
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ namespace graphene { namespace chain {
|
||||||
FC_ASSERT( bulk_discount_threshold_min <= bulk_discount_threshold_max );
|
FC_ASSERT( bulk_discount_threshold_min <= bulk_discount_threshold_max );
|
||||||
FC_ASSERT( bulk_discount_threshold_min > 0 );
|
FC_ASSERT( bulk_discount_threshold_min > 0 );
|
||||||
|
|
||||||
|
FC_ASSERT( block_interval >= GRAPHENE_MIN_BLOCK_INTERVAL );
|
||||||
FC_ASSERT( block_interval <= GRAPHENE_MAX_BLOCK_INTERVAL );
|
FC_ASSERT( block_interval <= GRAPHENE_MAX_BLOCK_INTERVAL );
|
||||||
FC_ASSERT( block_interval > 0 );
|
FC_ASSERT( block_interval > 0 );
|
||||||
FC_ASSERT( maintenance_interval > block_interval,
|
FC_ASSERT( maintenance_interval > block_interval,
|
||||||
|
|
|
||||||
|
|
@ -341,8 +341,6 @@ namespace graphene { namespace chain {
|
||||||
bool is_valid_v1( const std::string& base58str );
|
bool is_valid_v1( const std::string& base58str );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} } // graphene::chain
|
} } // graphene::chain
|
||||||
|
|
||||||
namespace fc
|
namespace fc
|
||||||
|
|
|
||||||
|
|
@ -2415,7 +2415,7 @@ namespace graphene { namespace net { namespace detail {
|
||||||
// they must be an attacker or have a buggy client.
|
// they must be an attacker or have a buggy client.
|
||||||
fc::time_point_sec minimum_time_of_last_offered_block =
|
fc::time_point_sec minimum_time_of_last_offered_block =
|
||||||
originating_peer->last_block_time_delegate_has_seen + // timestamp of the block immediately before the first unfetched block
|
originating_peer->last_block_time_delegate_has_seen + // timestamp of the block immediately before the first unfetched block
|
||||||
originating_peer->number_of_unfetched_item_ids * GRAPHENE_MAX_BLOCK_INTERVAL;
|
originating_peer->number_of_unfetched_item_ids * GRAPHENE_MIN_BLOCK_INTERVAL;
|
||||||
if (minimum_time_of_last_offered_block > _delegate->get_blockchain_now() + GRAPHENE_NET_FUTURE_SYNC_BLOCKS_GRACE_PERIOD_SEC)
|
if (minimum_time_of_last_offered_block > _delegate->get_blockchain_now() + GRAPHENE_NET_FUTURE_SYNC_BLOCKS_GRACE_PERIOD_SEC)
|
||||||
{
|
{
|
||||||
wlog("Disconnecting from peer ${peer} who offered us an implausible number of blocks, their last block would be in the future (${timestamp})",
|
wlog("Disconnecting from peer ${peer} who offered us an implausible number of blocks, their last block would be in the future (${timestamp})",
|
||||||
|
|
|
||||||
|
|
@ -494,7 +494,7 @@ namespace graphene { namespace net
|
||||||
// to give us some wiggle room)
|
// to give us some wiggle room)
|
||||||
return inventory_peer_advertised_to_us.size() >
|
return inventory_peer_advertised_to_us.size() >
|
||||||
GRAPHENE_NET_MAX_INVENTORY_SIZE_IN_MINUTES * GRAPHENE_NET_MAX_TRX_PER_SECOND * 60 +
|
GRAPHENE_NET_MAX_INVENTORY_SIZE_IN_MINUTES * GRAPHENE_NET_MAX_TRX_PER_SECOND * 60 +
|
||||||
(GRAPHENE_NET_MAX_INVENTORY_SIZE_IN_MINUTES + 1) * 60 / GRAPHENE_MAX_BLOCK_INTERVAL;
|
(GRAPHENE_NET_MAX_INVENTORY_SIZE_IN_MINUTES + 1) * 60 / GRAPHENE_MIN_BLOCK_INTERVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool peer_connection::performing_firewall_check() const
|
bool peer_connection::performing_firewall_check() const
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue