diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 22 | ||||
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 20 | ||||
-rw-r--r-- | src/wallet/wallet2.cpp | 2 |
3 files changed, 28 insertions, 16 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 54d8fac31..66e7acff8 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -807,16 +807,18 @@ difficulty_type Blockchain::get_difficulty_for_next_block() { LOG_PRINT_L3("Blockchain::" << __func__); - CRITICAL_REGION_LOCAL(m_difficulty_lock); - // we can call this without the blockchain lock, it might just give us - // something a bit out of date, but that's fine since anything which - // requires the blockchain lock will have acquired it in the first place, - // and it will be unlocked only when called from the getinfo RPC crypto::hash top_hash = get_tail_id(); - if (top_hash == m_difficulty_for_next_block_top_hash) - return m_difficulty_for_next_block; + { + CRITICAL_REGION_LOCAL(m_difficulty_lock); + // we can call this without the blockchain lock, it might just give us + // something a bit out of date, but that's fine since anything which + // requires the blockchain lock will have acquired it in the first place, + // and it will be unlocked only when called from the getinfo RPC + if (top_hash == m_difficulty_for_next_block_top_hash) + return m_difficulty_for_next_block; + } - CRITICAL_REGION_LOCAL1(m_blockchain_lock); + CRITICAL_REGION_LOCAL(m_blockchain_lock); std::vector<uint64_t> timestamps; std::vector<difficulty_type> difficulties; auto height = m_db->height(); @@ -860,6 +862,8 @@ difficulty_type Blockchain::get_difficulty_for_next_block() } size_t target = get_difficulty_target(); difficulty_type diff = next_difficulty(timestamps, difficulties, target); + + CRITICAL_REGION_LOCAL1(m_difficulty_lock); m_difficulty_for_next_block_top_hash = top_hash; m_difficulty_for_next_block = diff; return diff; @@ -3929,7 +3933,7 @@ uint64_t Blockchain::prevalidate_block_hashes(uint64_t height, const std::list<c // add to the known hashes array if (!valid) { - MWARNING("invalid hash for blocks " << n * HASH_OF_HASHES_STEP << " - " << (n * HASH_OF_HASHES_STEP + HASH_OF_HASHES_STEP - 1)); + MDEBUG("invalid hash for blocks " << n * HASH_OF_HASHES_STEP << " - " << (n * HASH_OF_HASHES_STEP + HASH_OF_HASHES_STEP - 1)); break; } diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index aa105567c..dc7b6b30f 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -2087,6 +2087,13 @@ namespace cryptonote if (d.cached && amount == 0 && d.cached_from == req.from_height && d.cached_to == req.to_height) { res.distributions.push_back({amount, d.cached_start_height, d.cached_distribution, d.cached_base}); + if (req.cumulative) + { + auto &distribution = res.distributions.back().distribution; + distribution[0] += d.cached_base; + for (size_t n = 1; n < distribution.size(); ++n) + distribution[n] += distribution[n-1]; + } continue; } @@ -2125,12 +2132,6 @@ namespace cryptonote if (offset <= req.to_height && req.to_height - offset + 1 < distribution.size()) distribution.resize(req.to_height - offset + 1); } - if (req.cumulative) - { - distribution[0] += base; - for (size_t n = 1; n < distribution.size(); ++n) - distribution[n] += distribution[n-1]; - } if (amount == 0) { @@ -2142,6 +2143,13 @@ namespace cryptonote d.cached = true; } + if (req.cumulative) + { + distribution[0] += base; + for (size_t n = 1; n < distribution.size(); ++n) + distribution[n] += distribution[n-1]; + } + res.distributions.push_back({amount, start_height, std::move(distribution), base}); } } diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 3af449455..365a14515 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -5672,7 +5672,7 @@ bool wallet2::find_and_save_rings(bool force) for (size_t slice = 0; slice < txs_hashes.size(); slice += SLICE_SIZE) { req.decode_as_json = false; - req.prune = true; + req.prune = false; req.txs_hashes.clear(); size_t ntxes = slice + SLICE_SIZE > txs_hashes.size() ? txs_hashes.size() - slice : SLICE_SIZE; for (size_t s = slice; s < slice + ntxes; ++s) |