aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic
diff options
context:
space:
mode:
Diffstat (limited to 'src/cryptonote_basic')
-rw-r--r--src/cryptonote_basic/account.cpp2
-rw-r--r--src/cryptonote_basic/connection_context.h10
-rw-r--r--src/cryptonote_basic/hardfork.cpp18
-rw-r--r--src/cryptonote_basic/miner.cpp5
4 files changed, 22 insertions, 13 deletions
diff --git a/src/cryptonote_basic/account.cpp b/src/cryptonote_basic/account.cpp
index bab991d19..aac6ec22b 100644
--- a/src/cryptonote_basic/account.cpp
+++ b/src/cryptonote_basic/account.cpp
@@ -157,7 +157,7 @@ DISABLE_VS_WARNINGS(4244 4345)
void account_base::create_from_viewkey(const cryptonote::account_public_address& address, const crypto::secret_key& viewkey)
{
crypto::secret_key fake;
- memset(&fake, 0, sizeof(fake));
+ memset(&unwrap(fake), 0, sizeof(fake));
create_from_keys(address, fake, viewkey);
}
//-----------------------------------------------------------------
diff --git a/src/cryptonote_basic/connection_context.h b/src/cryptonote_basic/connection_context.h
index 5cd1709ab..3f4651565 100644
--- a/src/cryptonote_basic/connection_context.h
+++ b/src/cryptonote_basic/connection_context.h
@@ -67,15 +67,15 @@ namespace cryptonote
switch (s)
{
case cryptonote_connection_context::state_before_handshake:
- return "state_before_handshake";
+ return "before_handshake";
case cryptonote_connection_context::state_synchronizing:
- return "state_synchronizing";
+ return "synchronizing";
case cryptonote_connection_context::state_standby:
- return "state_standby";
+ return "standby";
case cryptonote_connection_context::state_idle:
- return "state_idle";
+ return "idle";
case cryptonote_connection_context::state_normal:
- return "state_normal";
+ return "normal";
default:
return "unknown";
}
diff --git a/src/cryptonote_basic/hardfork.cpp b/src/cryptonote_basic/hardfork.cpp
index 95f1ecab9..f05b25901 100644
--- a/src/cryptonote_basic/hardfork.cpp
+++ b/src/cryptonote_basic/hardfork.cpp
@@ -379,20 +379,24 @@ uint8_t HardFork::get_ideal_version(uint64_t height) const
uint64_t HardFork::get_earliest_ideal_height_for_version(uint8_t version) const
{
- for (unsigned int n = heights.size() - 1; n > 0; --n) {
- if (heights[n].version <= version)
- return heights[n].height;
+ uint64_t height = std::numeric_limits<uint64_t>::max();
+ for (auto i = heights.rbegin(); i != heights.rend(); ++i) {
+ if (i->version >= version) {
+ height = i->height;
+ } else {
+ break;
+ }
}
- return 0;
+ return height;
}
uint8_t HardFork::get_next_version() const
{
CRITICAL_REGION_LOCAL(lock);
uint64_t height = db.height();
- for (unsigned int n = heights.size() - 1; n > 0; --n) {
- if (height >= heights[n].height) {
- return heights[n < heights.size() - 1 ? n + 1 : n].version;
+ for (auto i = heights.rbegin(); i != heights.rend(); ++i) {
+ if (height >= i->height) {
+ return (i == heights.rbegin() ? i : (i - 1))->version;
}
}
return original_version;
diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp
index 2c777f5a2..3a3222f9b 100644
--- a/src/cryptonote_basic/miner.cpp
+++ b/src/cryptonote_basic/miner.cpp
@@ -328,6 +328,11 @@ namespace cryptonote
LOG_PRINT_L0("Background mining controller thread started" );
}
+ if(get_ignore_battery())
+ {
+ MINFO("Ignoring battery");
+ }
+
return true;
}
//-----------------------------------------------------------------------------------------------------