Skip to content

Commit

Permalink
Merge pull request #397 from evoskuil/version3
Browse files Browse the repository at this point in the history
version 3.2.0
  • Loading branch information
evoskuil authored May 2, 2017
2 parents 0330928 + dee04a4 commit 04adac6
Show file tree
Hide file tree
Showing 22 changed files with 127 additions and 97 deletions.
Binary file modified builds/msvc/resource.rc
Binary file not shown.
8 changes: 4 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
AC_PREREQ([2.65])

# Process command-line arguments and perform initialization and verification.
AC_INIT([libbitcoin-server], [3.1.0], [eric@voskuil.org])
AC_INIT([libbitcoin-server], [3.2.0], [eric@voskuil.org])

# Do compilation tests.
AC_LANG(C++)
Expand Down Expand Up @@ -157,10 +157,10 @@ AS_CASE([${bash_completiondir}], [yes],
AC_MSG_NOTICE([bash_completion_LIBS : ${bash_completion_LIBS}])],
[AC_SUBST([bash_completion_PKG], [])])

# Require bitcoin-node of at least version 3.1.0 and output ${bitcoin_node_CPPFLAGS/LIBS/PKG}.
# Require bitcoin-node of at least version 3.2.0 and output ${bitcoin_node_CPPFLAGS/LIBS/PKG}.
#------------------------------------------------------------------------------
PKG_CHECK_MODULES([bitcoin_node], [libbitcoin-node >= 3.1.0])
AC_SUBST([bitcoin_node_PKG], ['libbitcoin-node >= 3.1.0'])
PKG_CHECK_MODULES([bitcoin_node], [libbitcoin-node >= 3.2.0])
AC_SUBST([bitcoin_node_PKG], ['libbitcoin-node >= 3.2.0'])
AC_SUBST([bitcoin_node_CPPFLAGS], [${bitcoin_node_CFLAGS}])
AC_MSG_NOTICE([bitcoin_node_CPPFLAGS : ${bitcoin_node_CPPFLAGS}])
AC_MSG_NOTICE([bitcoin_node_LIBS : ${bitcoin_node_LIBS}])
Expand Down
3 changes: 2 additions & 1 deletion console/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ executor::executor(parser& metadata, std::istream& input,
: metadata_(metadata), output_(output), error_(error)
{
const auto& network = metadata_.configured.network;
const auto verbose = network.verbose;

const log::rotable_file debug_file
{
Expand All @@ -78,7 +79,7 @@ executor::executor(parser& metadata, std::istream& input,
log::stream console_out(&output_, null_deleter());
log::stream console_err(&error_, null_deleter());

log::initialize(debug_file, error_file, console_out, console_err);
log::initialize(debug_file, error_file, console_out, console_err, verbose);
handle_stop(initialize_stop);
}

Expand Down
38 changes: 21 additions & 17 deletions data/bs.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ priority = true
use_libconsensus = false
# The maximum reorganization depth, defaults to 256 (0 for unlimited).
reorganization_limit = 256
# The block version for block creation and transaction pool validation, defaults to 4.
block_version = 4
# A hash:height checkpoint, multiple entries allowed, defaults shown.
checkpoint = 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f:0
checkpoint = 0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d:11111
Expand Down Expand Up @@ -154,12 +152,18 @@ bip65 = true
bip90 = true

[node]
# The time period for block polling after initial block download, defaults to 1 (0 disables).
block_poll_seconds = 1
# The minimum fee per byte required for transaction acceptance, defaults to 1.
minimum_byte_fee_satoshis = 1
# Request that peers relay transactions, defaults to false.
relay_transactions = false
# The time to wait for a requested block, defaults to 60.
block_latency_seconds = 60
# Disable relay when top block age exceeds, defaults to 24 (0 disables).
notify_limit_hours = 24
# The minimum fee per byte, cumulative for conflicts, defaults to 1.
byte_fee_satoshis = 1
# The minimum fee per sigop, additional to byte fee, defaults to 100.
sigop_fee_satoshis = 100
# The minimum output value, defaults to 500.
minimum_output_satoshis = 500
# Request that peers relay transactions, defaults to true.
relay_transactions = true
# Request transactions on each channel start, defaults to true.
refresh_transactions = true

Expand All @@ -176,16 +180,16 @@ handshake_seconds = 30
secure_only = false
# The number of query worker threads per endpoint, defaults to 1 (0 disables service).
query_workers = 1
# The maximum number of query subscriptions, defaults to 0 (subscription disabled).
subscription_limit = 0
# The query subscription expiration time, defaults to 10.
# The maximum number of query subscriptions, defaults to 1000 (0 disables subscribe).
subscription_limit = 1000
# The query subscription expiration time, defaults to 10 (0 disables expiration).
subscription_expiration_minutes = 10
# The heartbeat service interval, defaults to 0 (service disabled).
heartbeat_service_seconds = 0
# Enable the block publishing service, defaults to false.
block_service_enabled = false
# Enable the transaction publishing service, defaults to false.
transaction_service_enabled = false
# The heartbeat service interval, defaults to 5 (0 disables service).
heartbeat_service_seconds = 5
# Enable the block publishing service, defaults to true.
block_service_enabled = true
# Enable the transaction publishing service, defaults to true.
transaction_service_enabled = true

# The secure query endpoint, defaults to 'tcp://*:9081'.
secure_query_endpoint = tcp://*:9081
Expand Down
4 changes: 2 additions & 2 deletions include/bitcoin/server/interface/blockchain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class BCS_API blockchain
const chain::history_compact::list& history, const message& request,
send_handler handler);

static void transaction_fetched(const code& ec, transaction_ptr tx, size_t,
static void transaction_fetched(const code& ec, transaction_const_ptr tx, size_t,
size_t, const message& request, send_handler handler);

static void last_height_fetched(const code& ec, size_t last_height,
Expand Down Expand Up @@ -128,7 +128,7 @@ class BCS_API blockchain
const chain::stealth_compact::list& stealth_results,
const message& request, send_handler handler);

static void stealth_transaction_fetched(const code& ec,
static void stealth_transaction_hashes_fetched(const code& ec,
const chain::stealth_compact::list& stealth_results,
const message& request, send_handler handler);

Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/server/interface/transaction_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class BCS_API transaction_pool
send_handler handler);

private:
static void transaction_fetched(const code& ec, transaction_ptr tx,
static void transaction_fetched(const code& ec, transaction_const_ptr tx,
size_t, size_t, const message& request, send_handler handler);

static void handle_broadcast(const code& ec, const message& request,
Expand Down
5 changes: 2 additions & 3 deletions include/bitcoin/server/services/block_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class BCS_API block_service

private:
bool handle_reorganization(const code& ec, size_t fork_height,
block_const_ptr_list_const_ptr new_blocks,
block_const_ptr_list_const_ptr old_blocks);
block_const_ptr_list_const_ptr incoming,
block_const_ptr_list_const_ptr outgoing);

void publish_blocks(uint32_t fork_height,
block_const_ptr_list_const_ptr blocks);
Expand All @@ -68,7 +68,6 @@ class BCS_API block_service

// These are thread safe.
const bool secure_;
const bool verbose_;
const std::string security_;
const bc::server::settings& settings_;
const bc::protocol::settings& external_;
Expand Down
1 change: 0 additions & 1 deletion include/bitcoin/server/services/heartbeat_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class BCS_API heartbeat_service

// These are thread safe.
const bool secure_;
const bool verbose_;
const std::string security_;
const bc::server::settings& settings_;
const bc::protocol::settings& external_;
Expand Down
1 change: 0 additions & 1 deletion include/bitcoin/server/services/transaction_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class BCS_API transaction_service

// These are thread safe.
const bool secure_;
const bool verbose_;
const std::string security_;
const bc::server::settings& settings_;
const bc::protocol::settings& external_;
Expand Down
4 changes: 2 additions & 2 deletions include/bitcoin/server/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
* For interpretation of the versioning scheme see: http://semver.org
*/

#define LIBBITCOIN_SERVER_VERSION "3.1.0"
#define LIBBITCOIN_SERVER_VERSION "3.2.0"
#define LIBBITCOIN_SERVER_MAJOR_VERSION 3
#define LIBBITCOIN_SERVER_MINOR_VERSION 1
#define LIBBITCOIN_SERVER_MINOR_VERSION 2
#define LIBBITCOIN_SERVER_PATCH_VERSION 0

#endif
4 changes: 2 additions & 2 deletions include/bitcoin/server/workers/notification_worker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ class BCS_API notification_worker
bool stealth_subscriptions_empty() const;

bool handle_reorganization(const code& ec, size_t fork_height,
block_const_ptr_list_const_ptr new_blocks,
block_const_ptr_list_const_ptr old_blocks);
block_const_ptr_list_const_ptr incoming,
block_const_ptr_list_const_ptr outgoing);
bool handle_transaction_pool(const code& ec, transaction_const_ptr tx);

void notify_block(socket& dealer, size_t height, block_const_ptr block);
Expand Down
1 change: 0 additions & 1 deletion include/bitcoin/server/workers/query_worker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class BCS_API query_worker

// These are thread safe.
const bool secure_;
const bool verbose_;
const std::string security_;
const bc::server::settings& settings_;
const bc::protocol::settings& external_;
Expand Down
2 changes: 1 addition & 1 deletion libbitcoin-server.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Version: @PACKAGE_VERSION@
#==============================================================================
# Dependencies that publish package configuration.
#------------------------------------------------------------------------------
Requires: libbitcoin-protocol >= 3.1.0 libbitcoin-node >= 3.1.0
Requires: libbitcoin-protocol >= 3.1.0 libbitcoin-node >= 3.2.0

# Include directory and any other required compiler flags.
#------------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions src/interface/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void blockchain::fetch_transaction(server_node& node, const message& request,
_1, _2, _3, _4, request, handler));
}

void blockchain::transaction_fetched(const code& ec, transaction_ptr tx,
void blockchain::transaction_fetched(const code& ec, transaction_const_ptr tx,
size_t, size_t, const message& request, send_handler handler)
{
if (ec)
Expand Down Expand Up @@ -485,11 +485,11 @@ void blockchain::fetch_stealth_transaction_hashes(server_node& node,
const size_t from_height = deserial.read_4_bytes_little_endian();

node.chain().fetch_stealth(binary{ bits, blocks }, from_height,
std::bind(&blockchain::stealth_transaction_fetched,
std::bind(&blockchain::stealth_transaction_hashes_fetched,
_1, _2, request, handler));
}

void blockchain::stealth_transaction_fetched(const code& ec,
void blockchain::stealth_transaction_hashes_fetched(const code& ec,
const stealth_compact::list& stealth_results, const message& request,
send_handler handler)
{
Expand Down
5 changes: 3 additions & 2 deletions src/interface/transaction_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ void transaction_pool::fetch_transaction(server_node& node,
_1, _2, _3, _4, request, handler));
}

void transaction_pool::transaction_fetched(const code& ec, transaction_ptr tx,
size_t, size_t, const message& request, send_handler handler)
void transaction_pool::transaction_fetched(const code& ec,
transaction_const_ptr tx, size_t, size_t, const message& request,
send_handler handler)
{
if (ec)
{
Expand Down
49 changes: 28 additions & 21 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,6 @@ options_metadata parser::load_settings()
value<uint32_t>(&configured.chain.reorganization_limit),
"The maximum reorganization depth, defaults to 256 (0 for unlimited)."
)
(
"blockchain.block_version",
value<uint32_t>(&configured.chain.block_version),
"The block version for block creation and transaction pool validation, defaults to 4."
)
(
"blockchain.checkpoint",
value<config::checkpoint::list>(&configured.chain.checkpoints),
Expand All @@ -371,7 +366,7 @@ options_metadata parser::load_settings()
(
"fork.easy_blocks",
value<bool>(&configured.chain.easy_blocks),
"Allow minimum difficulty blocks, defaults to false (use true for testnet)."
"Allow minimum difficulty blocks, defaults to false."
)
(
"fork.bip16",
Expand Down Expand Up @@ -416,22 +411,34 @@ options_metadata parser::load_settings()
//// "The time limit for block response during initial block download, defaults to 5."
////)
(
"node.block_poll_seconds",
value<uint32_t>(&configured.node.block_poll_seconds),
"The time period for block polling after initial block download, defaults to 1 (0 disables)."
"node.block_latency_seconds",
value<uint32_t>(&configured.node.block_latency_seconds),
"The time to wait for a requested block, defaults to 60."
)
(
/* Internally this is blockchain, but it is conceptually a node setting. */
"node.minimum_byte_fee_satoshis",
value<float>(&configured.chain.minimum_byte_fee_satoshis),
"The minimum fee per byte required for transaction acceptance, defaults to 1."
"node.notify_limit_hours",
value<uint32_t>(&configured.chain.notify_limit_hours),
"Disable relay when top block age exceeds, defaults to 24 (0 disables)."
)
(
/* Internally this is blockchain, but it is conceptually a node setting. */
"node.byte_fee_satoshis",
value<float>(&configured.chain.byte_fee_satoshis),
"The minimum fee per byte, cumulative for conflicts, defaults to 1."
)
(
/* Internally this is blockchain, but it is conceptually a node setting. */
"node.sigop_fee_satoshis",
value<float>(&configured.chain.sigop_fee_satoshis),
"The minimum fee per sigop, additional to byte fee, defaults to 100."
)
(
/* Internally this is blockchain, but it is conceptually a node setting. */
"node.minimum_output_satoshis",
value<uint64_t>(&configured.chain.minimum_output_satoshis),
"The minimum output value, defaults to 500."
)
////(
//// /* Internally this is blockchain, but it is conceptually a node setting. */
//// "node.reject_conflicts",
//// value<bool>(&configured.chain.reject_conflicts),
//// "Retain only the first seen of conflicting transactions, defaults to true."
////)
(
/* Internally this is network, but it is conceptually a node setting. */
"node.relay_transactions",
Expand Down Expand Up @@ -482,17 +489,17 @@ options_metadata parser::load_settings()
(
"server.subscription_limit",
value<uint32_t>(&configured.server.subscription_limit),
"The maximum number of query subscriptions, defaults to 0 (subscription disabled)."
"The maximum number of query subscriptions, defaults to 1000 (0 disables subscribe)."
)
(
"server.subscription_expiration_minutes",
value<uint32_t>(&configured.server.subscription_expiration_minutes),
"The subscription expiration time, defaults to 10."
"The query subscription expiration time, defaults to 10 (0 disables expiration)."
)
(
"server.heartbeat_service_seconds",
value<uint32_t>(&configured.server.heartbeat_service_seconds),
"The heartbeat service interval, defaults to 0 (service disabled)."
"The heartbeat service interval, defaults to 5 (0 disables service)."
)
(
"server.block_service_enabled",
Expand Down
20 changes: 11 additions & 9 deletions src/services/block_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ block_service::block_service(zmq::authenticator& authenticator,
server_node& node, bool secure)
: worker(priority(node.server_settings().priority)),
secure_(secure),
verbose_(node.network_settings().verbose),
security_(secure ? "secure" : "public"),
settings_(node.server_settings()),
external_(node.protocol_settings()),
Expand Down Expand Up @@ -144,7 +143,7 @@ bool block_service::unbind(zmq::socket& xpub, zmq::socket& xsub)
// ----------------------------------------------------------------------------

bool block_service::handle_reorganization(const code& ec, size_t fork_height,
block_const_ptr_list_const_ptr new_blocks, block_const_ptr_list_const_ptr)
block_const_ptr_list_const_ptr incoming, block_const_ptr_list_const_ptr)
{
if (stopped() || ec == error::service_stopped)
return false;
Expand All @@ -158,12 +157,16 @@ bool block_service::handle_reorganization(const code& ec, size_t fork_height,
return true;
}

// Nothing to do here.
if (!new_blocks || new_blocks->empty())
// Nothing to do here, a channel is stopping.
if (!incoming || incoming->empty())
return true;

// Do not announce blocks to clients if too far behind.
if (node_.chain().is_stale())
return true;

// Blockchain height is 64 bit but obelisk protocol is 32 bit.
publish_blocks(safe_unsigned<uint32_t>(fork_height), new_blocks);
publish_blocks(safe_unsigned<uint32_t>(fork_height), incoming);
return true;
}

Expand Down Expand Up @@ -226,10 +229,9 @@ void block_service::publish_block(zmq::socket& publisher, size_t height,
}

// This isn't actually a request, should probably update settings.
if (verbose_)
LOG_DEBUG(LOG_SERVER)
<< "Published " << security_ << " block ["
<< encode_hash(block->hash()) << "] (" << sequence_ << ").";
LOG_VERBOSE(LOG_SERVER)
<< "Published " << security_ << " block ["
<< encode_hash(block->hash()) << "] (" << sequence_ << ").";
}

} // namespace server
Expand Down
4 changes: 1 addition & 3 deletions src/services/heartbeat_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ heartbeat_service::heartbeat_service(zmq::authenticator& authenticator,
server_node& node, bool secure)
: worker(priority(node.server_settings().priority)),
secure_(secure),
verbose_(node.network_settings().verbose),
security_(secure ? "secure" : "public"),
settings_(node.server_settings()),
external_(node.protocol_settings()),
Expand Down Expand Up @@ -148,8 +147,7 @@ void heartbeat_service::publish(zmq::socket& publisher)
}

// This isn't actually a request, should probably update settings.
if (verbose_)
LOG_DEBUG(LOG_SERVER)
LOG_VERBOSE(LOG_SERVER)
<< "Published " << security_ << " heartbeat [" << sequence_ << "].";
}

Expand Down
Loading

0 comments on commit 04adac6

Please sign in to comment.