Skip to content

Commit

Permalink
Merge pull request #313 from evoskuil/version3
Browse files Browse the repository at this point in the history
version 3.2.0
  • Loading branch information
evoskuil committed May 2, 2017
2 parents 5349882 + 21e9a9a commit 183fd1b
Show file tree
Hide file tree
Showing 17 changed files with 266 additions and 135 deletions.
Binary file modified builds/msvc/resource.rc
Binary file not shown.
14 changes: 7 additions & 7 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-node], [3.1.0], [eric@voskuil.org])
AC_INIT([libbitcoin-node], [3.2.0], [eric@voskuil.org])

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

# Require bitcoin-blockchain of at least version 3.1.0 and output ${bitcoin_blockchain_CPPFLAGS/LIBS/PKG}.
# Require bitcoin-blockchain of at least version 3.2.0 and output ${bitcoin_blockchain_CPPFLAGS/LIBS/PKG}.
#------------------------------------------------------------------------------
PKG_CHECK_MODULES([bitcoin_blockchain], [libbitcoin-blockchain >= 3.1.0])
AC_SUBST([bitcoin_blockchain_PKG], ['libbitcoin-blockchain >= 3.1.0'])
PKG_CHECK_MODULES([bitcoin_blockchain], [libbitcoin-blockchain >= 3.2.0])
AC_SUBST([bitcoin_blockchain_PKG], ['libbitcoin-blockchain >= 3.2.0'])
AC_SUBST([bitcoin_blockchain_CPPFLAGS], [${bitcoin_blockchain_CFLAGS}])
AC_MSG_NOTICE([bitcoin_blockchain_CPPFLAGS : ${bitcoin_blockchain_CPPFLAGS}])
AC_MSG_NOTICE([bitcoin_blockchain_LIBS : ${bitcoin_blockchain_LIBS}])

# Require bitcoin-network of at least version 3.1.0 and output ${bitcoin_network_CPPFLAGS/LIBS/PKG}.
# Require bitcoin-network of at least version 3.2.0 and output ${bitcoin_network_CPPFLAGS/LIBS/PKG}.
#------------------------------------------------------------------------------
PKG_CHECK_MODULES([bitcoin_network], [libbitcoin-network >= 3.1.0])
AC_SUBST([bitcoin_network_PKG], ['libbitcoin-network >= 3.1.0'])
PKG_CHECK_MODULES([bitcoin_network], [libbitcoin-network >= 3.2.0])
AC_SUBST([bitcoin_network_PKG], ['libbitcoin-network >= 3.2.0'])
AC_SUBST([bitcoin_network_CPPFLAGS], [${bitcoin_network_CFLAGS}])
AC_MSG_NOTICE([bitcoin_network_CPPFLAGS : ${bitcoin_network_CPPFLAGS}])
AC_MSG_NOTICE([bitcoin_network_LIBS : ${bitcoin_network_LIBS}])
Expand Down
3 changes: 2 additions & 1 deletion console/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,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 @@ -76,7 +77,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
20 changes: 12 additions & 8 deletions data/bn.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,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 @@ -150,11 +148,17 @@ 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
14 changes: 10 additions & 4 deletions include/bitcoin/node/protocols/protocol_block_in.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#ifndef LIBBITCOIN_NODE_PROTOCOL_BLOCK_IN_HPP
#define LIBBITCOIN_NODE_PROTOCOL_BLOCK_IN_HPP

#include <atomic>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <queue>
#include <bitcoin/blockchain.hpp>
#include <bitcoin/network.hpp>
#include <bitcoin/node/define.hpp>
Expand All @@ -46,9 +46,10 @@ class BCN_API protocol_block_in
virtual void start();

private:
typedef std::queue<hash_digest> hash_queue;

static void report(const chain::block& block);

void get_block_inventory(const code& ec);
void send_get_blocks(const hash_digest& stop_hash);
void send_get_data(const code& ec, get_data_ptr message);

Expand All @@ -60,14 +61,19 @@ class BCN_API protocol_block_in
void handle_fetch_block_locator(const code& ec, get_headers_ptr message,
const hash_digest& stop_hash);

void handle_timeout(const code& ec);
void handle_stop(const code& ec);

// These are thread safe.
full_node& node_;
blockchain::safe_chain& chain_;
bc::atomic<hash_digest> last_locator_top_;
const uint32_t block_poll_seconds_;
const asio::duration block_latency_;
const bool headers_from_peer_;
const bool blocks_from_peer_;

// This is protected by mutex.
hash_queue backlog_;
mutable upgrade_mutex mutex;
};

} // namespace node
Expand Down
6 changes: 3 additions & 3 deletions include/bitcoin/node/protocols/protocol_block_out.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ class BCN_API protocol_block_out
size_t locator_limit();

void send_next_data(inventory_ptr inventory);
void send_block(const code& ec, block_ptr message,
void send_block(const code& ec, block_const_ptr message,
uint64_t height, inventory_ptr inventory);
void send_merkle_block(const code& ec, merkle_block_ptr message,
void send_merkle_block(const code& ec, merkle_block_const_ptr message,
uint64_t height, inventory_ptr inventory);
void send_compact_block(const code& ec, compact_block_ptr message,
void send_compact_block(const code& ec, compact_block_const_ptr message,
uint64_t height, inventory_ptr inventory);

bool handle_receive_get_data(const code& ec,
Expand Down
5 changes: 3 additions & 2 deletions include/bitcoin/node/protocols/protocol_transaction_out.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class BCN_API protocol_transaction_out

private:
void send_next_data(inventory_ptr inventory);
void send_transaction(const code& ec, transaction_ptr transaction,
void send_transaction(const code& ec, transaction_const_ptr transaction,
size_t height, size_t position, inventory_ptr inventory);

bool handle_receive_get_data(const code& ec,
Expand All @@ -60,7 +60,8 @@ class BCN_API protocol_transaction_out

void handle_stop(const code& ec);
void handle_send_next(const code& ec, inventory_ptr inventory);
bool handle_notification(const code& ec, transaction_const_ptr message);
bool handle_transaction_pool(const code& ec,
transaction_const_ptr message);

blockchain::safe_chain& chain_;
std::atomic<uint64_t> minimum_peer_fee_;
Expand Down
5 changes: 4 additions & 1 deletion include/bitcoin/node/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ class BCN_API settings
/// Properties.
uint32_t sync_peers;
uint32_t sync_timeout_seconds;
uint32_t block_poll_seconds;
uint32_t block_latency_seconds;
bool refresh_transactions;

/// Helpers.
asio::duration block_latency() const;
};

} // namespace node
Expand Down
4 changes: 2 additions & 2 deletions include/bitcoin/node/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_NODE_VERSION "3.1.0"
#define LIBBITCOIN_NODE_VERSION "3.2.0"
#define LIBBITCOIN_NODE_MAJOR_VERSION 3
#define LIBBITCOIN_NODE_MINOR_VERSION 1
#define LIBBITCOIN_NODE_MINOR_VERSION 2
#define LIBBITCOIN_NODE_PATCH_VERSION 0

#endif
2 changes: 1 addition & 1 deletion libbitcoin-node.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-blockchain >= 3.1.0 libbitcoin-network >= 3.1.0
Requires: libbitcoin-blockchain >= 3.2.0 libbitcoin-network >= 3.2.0

# Include directory and any other required compiler flags.
#------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/full_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ bool full_node::stop()

if (!chain_stop)
LOG_ERROR(LOG_NODE)
<< "Failed to stop database.";
<< "Failed to stop blockchain.";

return p2p_stop && chain_stop;
}
Expand All @@ -280,7 +280,7 @@ bool full_node::close()

if (!chain_close)
LOG_ERROR(LOG_NODE)
<< "Failed to close database.";
<< "Failed to close blockchain.";

return p2p_close && chain_close;
}
Expand Down
45 changes: 26 additions & 19 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,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 @@ -361,7 +356,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 @@ -406,24 +401,36 @@ 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 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 network, but it is conceptually a node setting. */
/* Internally this is network, but it is conceptually a node setting. */
"node.relay_transactions",
value<bool>(&configured.network.relay_transactions),
"Request that peers relay transactions, defaults to false."
Expand Down
Loading

0 comments on commit 183fd1b

Please sign in to comment.