diff --git a/src/cryptonote_basic/difficulty.cpp b/src/cryptonote_basic/difficulty.cpp index 9b188f4d3..f3ff538c8 100644 --- a/src/cryptonote_basic/difficulty.cpp +++ b/src/cryptonote_basic/difficulty.cpp @@ -256,9 +256,8 @@ difficulty_type next_difficulty_v3(std::vector timestamps, std::v // TODO: change initial_difficulty_guess before v9 mainnet hard fork // if ( height >= fork_height && height <= fork_height+N ) { return difficulty_guess; } uint64_t initial_difficulty_guess = 100; - if (timestamps.size() <= static_cast(N)) { - return initial_difficulty_guess; - } + if (timestamps.size() <= 6 ) { return initial_difficulty_guess; } + else if ( timestamps.size() < static_cast(N +1) ) { N=timestamps.size()-1; } for ( int64_t i = 1; i <= N; i++) { ST = std::max(-FTL, std::min( (int64_t)(timestamps[i]) - (int64_t)(timestamps[i-1]), 6*T)); @@ -266,9 +265,10 @@ difficulty_type next_difficulty_v3(std::vector timestamps, std::v if ( i > N-3 ) { sum_3_ST += ST; } } - next_D = ((cumulative_difficulties[N] - cumulative_difficulties[0])*T*(N+1)*99)/(100*2*L); + next_D = ((int64_t)(cumulative_difficulties[N] - cumulative_difficulties[0])*T*(N+1)*99)/(100*2*L); prev_D = cumulative_difficulties[N] - cumulative_difficulties[N-1]; + next_D = std::max((prev_D*67)/100, std::min( next_D, (prev_D*150)/100)); if ( sum_3_ST < (8*T)/10) { next_D = (prev_D*110)/100; } return static_cast(next_D); diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 04abae750..6be898295 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -60,6 +60,7 @@ namespace Monero { namespace { // copy-pasted from simplewallet + static const size_t DEFAULT_MIXIN = 9; static const int DEFAULT_REFRESH_INTERVAL_MILLIS = 1000 * 10; // limit maximum refresh interval as one minute static const int MAX_REFRESH_INTERVAL_MILLIS = 1000 * 60 * 1; @@ -1405,6 +1406,15 @@ void WalletImpl::setListener(WalletListener *l) m_wallet2Callback->setListener(l); } +uint32_t WalletImpl::defaultMixin() const +{ + return m_wallet->default_mixin(); +} + +void WalletImpl::setDefaultMixin(uint32_t arg) +{ + m_wallet->default_mixin(arg); +} bool WalletImpl::setUserNote(const std::string &txid, const std::string ¬e) {