summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Taaki <genjix@riseup.net>2013-06-10 14:00:15 (GMT)
committer Amir Taaki <genjix@riseup.net>2013-06-10 14:00:15 (GMT)
commit2e873a5f38bcae2bae3cfc1225dadf8faaedc010 (patch)
treee764110d111373289727c6f65e317f18bb4a45dd
parent29a3930b4eb37f3d1ab19e685cfcae5e0f8564ad (diff)
fRelayTxes is not included in the version message in any deterministic way.v1.0.1-r2
Revert "updated version primitive with 'relay_transactions' field, and bumped protocol_version to 70001" This reverts commit b80b143f406302c7a123ee0f67159a0cdcaac3a7.
-rw-r--r--doc/sphinx/examples/connect.rst5
-rw-r--r--doc/sphinx/network.rst3
-rw-r--r--examples/connect.cpp5
-rw-r--r--include/bitcoin/constants.hpp2
-rw-r--r--include/bitcoin/primitives.hpp1
-rw-r--r--include/bitcoin/satoshi_serialize.hpp9
-rw-r--r--src/network/handshake.cpp3
-rw-r--r--src/satoshi_serialize.cpp2
8 files changed, 9 insertions, 21 deletions
diff --git a/doc/sphinx/examples/connect.rst b/doc/sphinx/examples/connect.rst
index a79dc11..6633618 100644
--- a/doc/sphinx/examples/connect.rst
+++ b/doc/sphinx/examples/connect.rst
@@ -27,7 +27,7 @@ examples/connect.cpp
// Create our version message we want to send.
// Fill in a bunch of fields.
version_type version;
- version.version = 70001;
+ version.version = 60000;
version.services = 1;
version.address_me.services = version.services;
version.address_me.ip =
@@ -39,11 +39,10 @@ examples/connect.cpp
ip_address_type{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x01};
version.address_you.port = 8333;
- version.nonce = rand();
// Set the user agent.
version.user_agent = "/libbitcoin/connect-test/";
version.start_depth = 0;
- version.relay_transactions = true;
+ version.nonce = rand();
// Begin the send.
// Calls version_sent callback when complete.
node->send(version, std::bind(version_sent, _1, node));
diff --git a/doc/sphinx/network.rst b/doc/sphinx/network.rst
index febd091..8576876 100644
--- a/doc/sphinx/network.rst
+++ b/doc/sphinx/network.rst
@@ -76,11 +76,10 @@ for this field.
ip_address_type{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x01};
version.address_you.port = 8333;
- version.nonce = rand();
// Set the user agent.
version.user_agent = "/libbitcoin/connect-test/";
version.start_depth = 0;
- version.relay_transactions = true;
+ version.nonce = rand();
We then send the message by calling :func:`channel::send` on the
:class:`channel_ptr` object.
diff --git a/examples/connect.cpp b/examples/connect.cpp
index 1dc1a76..b82a010 100644
--- a/examples/connect.cpp
+++ b/examples/connect.cpp
@@ -23,7 +23,7 @@ void connect_started(const std::error_code& ec, channel_ptr node)
// Create our version message we want to send.
// Fill in a bunch of fields.
version_type version;
- version.version = 70001;
+ version.version = 60000;
version.services = 1;
version.address_me.services = version.services;
version.address_me.ip =
@@ -35,11 +35,10 @@ void connect_started(const std::error_code& ec, channel_ptr node)
ip_address_type{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x01};
version.address_you.port = 8333;
- version.nonce = rand();
// Set the user agent.
version.user_agent = "/libbitcoin/connect-test/";
version.start_depth = 0;
- version.relay_transactions = true;
+ version.nonce = rand();
// Begin the send.
// Calls version_sent callback when complete.
node->send(version, std::bind(version_sent, _1, node));
diff --git a/include/bitcoin/constants.hpp b/include/bitcoin/constants.hpp
index 86e937d..86b9849 100644
--- a/include/bitcoin/constants.hpp
+++ b/include/bitcoin/constants.hpp
@@ -7,7 +7,7 @@
namespace libbitcoin {
-constexpr uint32_t protocol_version = 70001;
+constexpr uint32_t protocol_version = 60000;
constexpr uint64_t block_reward = 50;
// 210000 ~ 4 years / 10 minutes
diff --git a/include/bitcoin/primitives.hpp b/include/bitcoin/primitives.hpp
index 2fc4126..a62adc7 100644
--- a/include/bitcoin/primitives.hpp
+++ b/include/bitcoin/primitives.hpp
@@ -58,7 +58,6 @@ struct version_type
uint64_t nonce;
std::string user_agent;
uint32_t start_depth;
- bool relay_transactions;
};
struct verack_type
diff --git a/include/bitcoin/satoshi_serialize.hpp b/include/bitcoin/satoshi_serialize.hpp
index 7d66ed0..d0c8d7e 100644
--- a/include/bitcoin/satoshi_serialize.hpp
+++ b/include/bitcoin/satoshi_serialize.hpp
@@ -56,7 +56,6 @@ void satoshi_save(const version_type& packet, Iterator result)
serial.write_8_bytes(packet.nonce);
serial.write_string(packet.user_agent);
serial.write_4_bytes(packet.start_depth);
- serial.write_byte(packet.relay_transactions);
data_chunk raw_data = serial.data();
BITCOIN_ASSERT(satoshi_raw_size(packet) == raw_data.size());
std::copy(raw_data.begin(), raw_data.end(), result);
@@ -88,13 +87,7 @@ void satoshi_load(Iterator first, Iterator last, version_type& packet)
return;
}
packet.start_depth = deserial.read_4_bytes();
- if (packet.version < 70001)
- {
- BITCOIN_ASSERT(stream.size() >= 4 + 8 + 8 + 26 + 26 + 8 + 1 + 4);
- return;
- }
- packet.relay_transactions = deserial.read_byte();
- BITCOIN_ASSERT(stream.size() >= 4 + 8 + 8 + 26 + 26 + 8 + 1 + 4 + 1);
+ BITCOIN_ASSERT(stream.size() >= 4 + 8 + 8 + 26 + 26 + 8 + 1 + 4);
BITCOIN_ASSERT(satoshi_raw_size(packet) == stream.size());
}
diff --git a/src/network/handshake.cpp b/src/network/handshake.cpp
index 3dc9f42..73084b2 100644
--- a/src/network/handshake.cpp
+++ b/src/network/handshake.cpp
@@ -31,10 +31,9 @@ handshake::handshake(threadpool& pool)
ip_address_type{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x01};
template_version_.address_you.port = 8333;
- template_version_.nonce = rand();
template_version_.user_agent = "/libbitcoin:" LIBBITCOIN_LIB_VERSION "/";
template_version_.start_depth = 0;
- template_version_.relay_transactions = true;
+ template_version_.nonce = rand();
}
void handshake::start(start_handler handle_start)
diff --git a/src/satoshi_serialize.cpp b/src/satoshi_serialize.cpp
index 5cef021..0b1ba45 100644
--- a/src/satoshi_serialize.cpp
+++ b/src/satoshi_serialize.cpp
@@ -25,7 +25,7 @@ const std::string satoshi_command(const version_type&)
}
size_t satoshi_raw_size(const version_type& packet)
{
- return 85 +
+ return 84 +
variable_uint_size(packet.user_agent.size()) +
packet.user_agent.size();
}