aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--external/boost/archive/portable_binary_iarchive.hpp30
-rw-r--r--external/boost/archive/portable_binary_oarchive.hpp17
-rw-r--r--src/cryptonote_core/blockchain.cpp7
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp11
-rw-r--r--tests/unit_tests/http_auth.cpp8
5 files changed, 60 insertions, 13 deletions
diff --git a/external/boost/archive/portable_binary_iarchive.hpp b/external/boost/archive/portable_binary_iarchive.hpp
index c33085b05..7149cca0f 100644
--- a/external/boost/archive/portable_binary_iarchive.hpp
+++ b/external/boost/archive/portable_binary_iarchive.hpp
@@ -22,6 +22,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <istream>
+#include <boost/version.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/item_version_type.hpp>
#include <boost/archive/archive_exception.hpp>
@@ -153,6 +154,7 @@ protected:
}
typedef boost::archive::detail::common_iarchive<portable_binary_iarchive>
detail_common_iarchive;
+#if BOOST_VERSION > 105800
template<class T>
void load_override(T & t){
this->detail_common_iarchive::load_override(t);
@@ -160,6 +162,15 @@ protected:
void load_override(boost::archive::class_name_type & t);
// binary files don't include the optional information
void load_override(boost::archive::class_id_optional_type &){}
+#else
+ template<class T>
+ void load_override(T & t, int){
+ this->detail_common_iarchive::load_override(t, 0);
+ }
+ void load_override(boost::archive::class_name_type & t, int);
+ // binary files don't include the optional information
+ void load_override(boost::archive::class_id_optional_type &, int){}
+#endif
void init(unsigned int flags);
public:
@@ -257,6 +268,7 @@ portable_binary_iarchive::load_impl(boost::intmax_t & l, char maxsize){
l = -l;
}
+#if BOOST_VERSION > 105800
inline void
portable_binary_iarchive::load_override(
boost::archive::class_name_type & t
@@ -273,6 +285,24 @@ portable_binary_iarchive::load_override(
// borland tweak
t.t[cn.size()] = '\0';
}
+#else
+inline void
+portable_binary_iarchive::load_override(
+ boost::archive::class_name_type & t, int
+){
+ std::string cn;
+ cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE);
+ load_override(cn, 0);
+ if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1))
+ boost::serialization::throw_exception(
+ boost::archive::archive_exception(
+ boost::archive::archive_exception::invalid_class_name)
+ );
+ std::memcpy(t, cn.data(), cn.size());
+ // borland tweak
+ t.t[cn.size()] = '\0';
+}
+#endif
inline void
portable_binary_iarchive::init(unsigned int flags){
diff --git a/external/boost/archive/portable_binary_oarchive.hpp b/external/boost/archive/portable_binary_oarchive.hpp
index 19027f65a..8fd7090a1 100644
--- a/external/boost/archive/portable_binary_oarchive.hpp
+++ b/external/boost/archive/portable_binary_oarchive.hpp
@@ -22,6 +22,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <ostream>
+#include <boost/version.hpp>
#include <boost/serialization/string.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/archive/basic_binary_oprimitive.hpp>
@@ -133,6 +134,7 @@ protected:
// extra stuff to get it passed borland compilers
typedef boost::archive::detail::common_oarchive<portable_binary_oarchive>
detail_common_oarchive;
+#if BOOST_VERSION > 105800
template<class T>
void save_override(T & t){
this->detail_common_oarchive::save_override(t);
@@ -146,6 +148,21 @@ protected:
void save_override(
const boost::archive::class_id_optional_type & /* t */
){}
+#else
+ template<class T>
+ void save_override(T & t, int){
+ this->detail_common_oarchive::save_override(t, 0);
+ }
+ // explicitly convert to char * to avoid compile ambiguities
+ void save_override(const boost::archive::class_name_type & t, int){
+ const std::string s(t);
+ * this << s;
+ }
+ // binary files don't include the optional information
+ void save_override(
+ const boost::archive::class_id_optional_type & /* t */, int
+ ){}
+#endif
void init(unsigned int flags);
public:
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index a23d51126..42279184a 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -953,6 +953,7 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height)
LOG_PRINT_RED_L1("The miner transaction in block has invalid height: " << boost::get<txin_gen>(b.miner_tx.vin[0]).height << ", expected: " << height);
return false;
}
+ LOG_PRINT_L1("Miner tx hash: " << get_transaction_hash(b.miner_tx));
CHECK_AND_ASSERT_MES(b.miner_tx.unlock_time == height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, false, "coinbase transaction transaction has the wrong unlock time=" << b.miner_tx.unlock_time << ", expected " << height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW);
//check outs overflow
@@ -2195,8 +2196,10 @@ bool Blockchain::check_tx_inputs(transaction& tx, uint64_t& max_used_block_heigh
bool res = check_tx_inputs(tx, tvc, &max_used_block_height);
TIME_MEASURE_FINISH(a);
if(m_show_time_stats)
- LOG_PRINT_L0("HASH: " << "+" << " VIN/VOUT: " << tx.vin.size() << "/" << tx.vout.size() << " H: " << max_used_block_height << " chcktx: " << a + m_fake_scan_time);
-
+ {
+ size_t mix = tx.vin[0].type() == typeid(txin_to_key) ? boost::get<txin_to_key>(tx.vin[0]).key_offsets.size() : 0;
+ LOG_PRINT_L0("HASH: " << get_transaction_hash(tx) << " VIN/MIX/VOUT: " << tx.vin.size() << "/" << mix << "/" << tx.vout.size() << " H: " << max_used_block_height << " ms: " << a + m_fake_scan_time);
+ }
if (!res)
return false;
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 3ddda9efb..4010d3d44 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -619,17 +619,16 @@ namespace cryptonote
std::pair<uint64_t, uint64_t> core::get_coinbase_tx_sum(const uint64_t start_offset, const size_t count)
{
std::list<block> blocks;
- std::list<transaction> txs;
- std::list<crypto::hash> missed_txs;
- uint64_t coinbase_amount = 0;
uint64_t emission_amount = 0;
uint64_t total_fee_amount = 0;
- uint64_t tx_fee_amount = 0;
this->get_blocks(start_offset, count, blocks);
BOOST_FOREACH(auto& b, blocks)
{
- coinbase_amount = get_outs_money_amount(b.miner_tx);
+ std::list<transaction> txs;
+ std::list<crypto::hash> missed_txs;
+ uint64_t coinbase_amount = get_outs_money_amount(b.miner_tx);
this->get_transactions(b.tx_hashes, txs, missed_txs);
+ uint64_t tx_fee_amount = 0;
BOOST_FOREACH(const auto& tx, txs)
{
tx_fee_amount += get_tx_fee(tx);
@@ -637,8 +636,6 @@ namespace cryptonote
emission_amount += coinbase_amount - tx_fee_amount;
total_fee_amount += tx_fee_amount;
- coinbase_amount = 0;
- tx_fee_amount = 0;
}
return std::pair<uint64_t, uint64_t>(emission_amount, total_fee_amount);
diff --git a/tests/unit_tests/http_auth.cpp b/tests/unit_tests/http_auth.cpp
index e37ded34a..7158850b6 100644
--- a/tests/unit_tests/http_auth.cpp
+++ b/tests/unit_tests/http_auth.cpp
@@ -241,7 +241,7 @@ TEST(HTTP_Auth, MD5)
epee::net_utils::http::http_auth::login user{"foo", "bar"};
epee::net_utils::http::http_auth auth{user};
- const auto response = auth.get_response(make_request({}));
+ const auto response = auth.get_response(make_request(fields{}));
ASSERT_TRUE(bool(response));
EXPECT_TRUE(is_unauthorized(*response));
@@ -290,7 +290,7 @@ TEST(HTTP_Auth, MD5_sess)
epee::net_utils::http::http_auth::login user{"foo", "bar"};
epee::net_utils::http::http_auth auth{user};
- const auto response = auth.get_response(make_request({}));
+ const auto response = auth.get_response(make_request(fields{}));
ASSERT_TRUE(bool(response));
EXPECT_TRUE(is_unauthorized(*response));
@@ -342,7 +342,7 @@ TEST(HTTP_Auth, MD5_auth)
epee::net_utils::http::http_auth::login user{"foo", "bar"};
epee::net_utils::http::http_auth auth{user};
- const auto response = auth.get_response(make_request({}));
+ const auto response = auth.get_response(make_request(fields{}));
ASSERT_TRUE(bool(response));
EXPECT_TRUE(is_unauthorized(*response));
@@ -410,7 +410,7 @@ TEST(HTTP_Auth, MD5_sess_auth)
epee::net_utils::http::http_auth::login user{"foo", "bar"};
epee::net_utils::http::http_auth auth{user};
- const auto response = auth.get_response(make_request({}));
+ const auto response = auth.get_response(make_request(fields{}));
ASSERT_TRUE(bool(response));
EXPECT_TRUE(is_unauthorized(*response));