mirror of
https://git.wownero.com/wownero/wownero.git
synced 2025-01-06 20:38:53 +00:00
Merge pull request #122 from wowario/v0.4
Add LWMA-4, ASCII art, 10v fork height
This commit is contained in:
commit
db77810cd4
@ -96,6 +96,7 @@ Dates are provided in the format YYYY-MM-DD.
|
||||
| 1 | 2018-04-01 | v7 | v0.1.0.0 | v0.1.0.0 | Cryptonight variant 1, ringsize >= 8, sorted inputs
|
||||
| 6969 | 2018-04-24 | v8 | v0.2.0.0 | v0.2.0.0 | Bulletproofs, LWMA difficulty algorithm, ringsize >= 10, reduce unlock to 4
|
||||
| 53666 | 2018-10-06 | v9 | v0.3.0.0 | v0.3.1.3 | Cryptonight variant 2, LWMA v2, ringsize = 22, MMS
|
||||
| 63469 | 2018-11-11 | v10 | v0.4.0.0 | v0.4.0.0 | LWMA v4
|
||||
|
||||
X's indicate that these details have not been determined as of commit date.
|
||||
|
||||
|
Binary file not shown.
@ -204,6 +204,9 @@ namespace cryptonote
|
||||
ADD_CHECKPOINT(62503, "25fa115962988b4b8f8cfd22744a3e653b22ead8c8468e64caf334fc75a97d08");
|
||||
ADD_CHECKPOINT(62550, "bde522a8a81c392c98c979434aa1dd9d20b4ca52230ba6ae0362872757808a48");
|
||||
ADD_CHECKPOINT(62629, "8368e1ce1d421f1fc969364558433e2b2363d0ffcb5f2d946633095e3e6734f5");
|
||||
ADD_CHECKPOINT(62720, "f871cddd75951e2fe24c282d2bd28396fc922ea519b354ace992a0162cb333ff");
|
||||
ADD_CHECKPOINT(62733, "8331dbeeaf23173d2235a062373a437befadb6492cceb7640127bf18653a9e61");
|
||||
ADD_CHECKPOINT(62877, "62d44adc05d7d4fd9d15239c5575612207beab0bcf2da49158bf89e365441ca1");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -285,42 +285,71 @@ namespace cryptonote {
|
||||
}
|
||||
}
|
||||
|
||||
// LWMA-3 difficulty algorithm
|
||||
// LWMA-4 difficulty algorithm
|
||||
// Copyright (c) 2017-2018 Zawy, MIT License
|
||||
// https://github.com/zawy12/difficulty-algorithms/issues/3
|
||||
difficulty_type next_difficulty_v4(std::vector<uint64_t> timestamps, std::vector<difficulty_type> cumulative_difficulties, size_t height) {
|
||||
|
||||
uint64_t T = DIFFICULTY_TARGET_V2;
|
||||
uint64_t N = DIFFICULTY_WINDOW_V2;
|
||||
uint64_t L(0), ST, sum_3_ST(0), next_D, prev_D, this_timestamp, previous_timestamp;
|
||||
|
||||
uint64_t T = DIFFICULTY_TARGET_V2;
|
||||
uint64_t N = DIFFICULTY_WINDOW_V2; // N=45, 60, and 90 for T=600, 120, 60.
|
||||
uint64_t L(0), ST(0), next_D, prev_D, avg_D, i;
|
||||
|
||||
assert(timestamps.size() == cumulative_difficulties.size() && timestamps.size() <= N+1 );
|
||||
|
||||
if ( height == DIFFICULTY_HEIGHT_V2 ){
|
||||
return static_cast<uint64_t>(DIFFICULTY_GUESS);
|
||||
}
|
||||
if ( height <= DIFFICULTY_HEIGHT + 1 ) { return DIFFICULTY_GUESS; }
|
||||
|
||||
// Safely convert out-of-sequence timestamps into > 0 solvetimes.
|
||||
std::vector<uint64_t>TS(N+1);
|
||||
TS[0] = timestamps[0];
|
||||
for ( i = 1; i <= N; i++) {
|
||||
if ( timestamps[i] > TS[i-1] ) { TS[i] = timestamps[i]; }
|
||||
else { TS[i] = TS[i-1]; }
|
||||
}
|
||||
|
||||
previous_timestamp = timestamps[0];
|
||||
for ( uint64_t i = 1; i <= N; i++) {
|
||||
if ( timestamps[i] > previous_timestamp ) {
|
||||
this_timestamp = timestamps[i];
|
||||
} else { this_timestamp = previous_timestamp+1; }
|
||||
ST = std::min(6*T ,this_timestamp - previous_timestamp);
|
||||
previous_timestamp = this_timestamp;
|
||||
L += ST * i ;
|
||||
if ( i > N-3 ) { sum_3_ST += ST; }
|
||||
}
|
||||
for ( i = 1; i <= N; i++) {
|
||||
// Temper long solvetime drops if they were preceded by 3 or 6 fast solves.
|
||||
if ( i > 4 && TS[i]-TS[i-1] > 5*T && TS[i-1] - TS[i-4] < (14*T)/10 ) { ST = 2*T; }
|
||||
else if ( i > 7 && TS[i]-TS[i-1] > 5*T && TS[i-1] - TS[i-7] < 4*T ) { ST = 2*T; }
|
||||
else { // Assume normal conditions, so get ST.
|
||||
// LWMA drops too much from long ST, so limit drops with a 5*T limit
|
||||
ST = std::min(5*T ,TS[i] - TS[i-1]);
|
||||
}
|
||||
L += ST * i ;
|
||||
}
|
||||
if (L < N*N*T/20 ) { L = N*N*T/20; }
|
||||
avg_D = ( cumulative_difficulties[N] - cumulative_difficulties[0] )/ N;
|
||||
|
||||
// Prevent round off error for small D and overflow for large D.
|
||||
if (avg_D > 2000000*N*N*T) {
|
||||
next_D = (avg_D/(200*L))*(N*(N+1)*T*97);
|
||||
}
|
||||
else { next_D = (avg_D*N*(N+1)*T*97)/(200*L); }
|
||||
|
||||
next_D = ((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));
|
||||
prev_D = cumulative_difficulties[N] - cumulative_difficulties[N-1] ;
|
||||
|
||||
if ( sum_3_ST < (8*T)/10) { next_D = std::max(next_D,(prev_D*108)/100); }
|
||||
// Apply 10% jump rule.
|
||||
if ( ( TS[N] - TS[N-1] < (2*T)/10 ) ||
|
||||
( TS[N] - TS[N-2] < (5*T)/10 ) ||
|
||||
( TS[N] - TS[N-3] < (8*T)/10 ) )
|
||||
{
|
||||
next_D = std::max( next_D, std::min( (prev_D*110)/100, (105*avg_D)/100 ) );
|
||||
}
|
||||
// Make all insignificant digits zero for easy reading.
|
||||
i = 1000000000;
|
||||
while (i > 1) {
|
||||
if ( next_D > i*100 ) { next_D = ((next_D+i/2)/i)*i; break; }
|
||||
else { i /= 10; }
|
||||
}
|
||||
// Make least 3 digits equal avg of past 10 solvetimes.
|
||||
if ( next_D > 100000 ) {
|
||||
next_D = ((next_D+500)/1000)*1000 + std::min(static_cast<uint64_t>(999), (TS[N]-TS[N-10])/10);
|
||||
}
|
||||
|
||||
if ( next_D < DIFFICULTY_MINIMUM ) {
|
||||
return static_cast<uint64_t>(DIFFICULTY_MINIMUM);
|
||||
}
|
||||
else {
|
||||
return static_cast<uint64_t>(next_D);
|
||||
}
|
||||
if ( next_D < DIFFICULTY_MINIMUM ) {
|
||||
return static_cast<uint64_t>(DIFFICULTY_MINIMUM);
|
||||
}
|
||||
else {
|
||||
return static_cast<uint64_t>(next_D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,10 +82,9 @@
|
||||
#define DIFFICULTY_CUT 60 // timestamps to cut after sorting
|
||||
#define DIFFICULTY_BLOCKS_COUNT_V2 DIFFICULTY_WINDOW_V2 + 1 // added +1 to make N=N
|
||||
#define DIFFICULTY_BLOCKS_COUNT DIFFICULTY_WINDOW + DIFFICULTY_LAG
|
||||
#define DIFFICULTY_HEIGHT 53666 // v9 fork height
|
||||
#define DIFFICULTY_HEIGHT_V2 777777 // v10 fork height
|
||||
#define DIFFICULTY_GUESS 40000000 // difficulty at fork 40m
|
||||
#define DIFFICULTY_MINIMUM 25000000 // minimum difficulty set to 25m
|
||||
#define DIFFICULTY_HEIGHT 63469 // v10 fork height
|
||||
#define DIFFICULTY_GUESS 100000069 // difficulty at fork 100m
|
||||
#define DIFFICULTY_MINIMUM 40000069 // minimum difficulty set to 40m
|
||||
|
||||
#define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V1 DIFFICULTY_TARGET_V1 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS
|
||||
#define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V2 DIFFICULTY_TARGET_V2 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS
|
||||
|
@ -93,6 +93,7 @@ static const struct {
|
||||
{ 7, 1, 0, 1519605000 },
|
||||
{ 8, 6969, 0, 1524214739 },
|
||||
{ 9, 53666, 0, 1538689773 },
|
||||
{ 10, 63469, 0, 1541700352 },
|
||||
};
|
||||
|
||||
static const uint64_t mainnet_hard_fork_version_1_till = ((uint64_t)(0));
|
||||
@ -1061,7 +1062,7 @@ difficulty_type Blockchain::get_next_difficulty_for_alternative_chain(const std:
|
||||
return next_difficulty_v2(timestamps, cumulative_difficulties, target);
|
||||
}
|
||||
else if (version == 9) {
|
||||
return next_difficulty_v2(timestamps, cumulative_difficulties, height);
|
||||
return next_difficulty_v3(timestamps, cumulative_difficulties, height);
|
||||
}
|
||||
else {
|
||||
return next_difficulty_v4(timestamps, cumulative_difficulties, height);
|
||||
@ -4452,7 +4453,7 @@ void Blockchain::cancel()
|
||||
}
|
||||
|
||||
#if defined(PER_BLOCK_CHECKPOINT)
|
||||
static const char expected_block_hashes_hash[] = "991bae8e227c5ba51767522aaea4fc7c1e54be8528793fe9301aff8f3031b7d7";
|
||||
static const char expected_block_hashes_hash[] = "e06ddfd59a891d5e63e80795d8e0494a7c1e3b01a1faa4ed91b015ecfc38c003";
|
||||
void Blockchain::load_compiled_in_block_hashes()
|
||||
{
|
||||
const bool testnet = m_nettype == TESTNET;
|
||||
|
@ -1344,16 +1344,24 @@ namespace cryptonote
|
||||
main_message = "The daemon is running offline and will not attempt to sync to the Monero network.";
|
||||
else
|
||||
main_message = "The daemon will start synchronizing with the network. This may take a long time to complete.";
|
||||
MGINFO_BLUE(ENDL <<
|
||||
MGINFO_GREEN(ENDL <<
|
||||
"\n \n"
|
||||
"░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"
|
||||
"░░░░░░░░░░░░░▄█▄░░░░████▄░████▄░█░░░░░░░░▄█▄░░░░██░░░░▄▀░░▄███▄░░░░░░░░░░░░\n"
|
||||
"░░░░░░░░░░░░░█▀ ▀▄░░█░░░█░█░░░█░█░░░░░░░░█▀ ▀▄░░█ █░░▄▀░░░█▀░░░▀░░░░░░░░░░░\n"
|
||||
"░░░░░░░░░░░░░█░░░░░░█░░░█░█░░░█░█░░░░░░░░█░░░░░░█▄▄█ █░▀▄░██▄▄░░░░░░░░░░░░░\n"
|
||||
"░░░░░░░░░░░░░█▄░░▄▀ ▀████░▀████░███▄░░░░░█▄░░▄▀ █░░█ █░░░█░█▄░░░▄▀░░░░░░░░░\n"
|
||||
"░░░░░░░░░░░░░▀███▀░░░░░░░░░░░░░░░░░░▀░░░░▀███▀░░░░░█░░███░░▀███▀░░░░░░░░░░░\n"
|
||||
"░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█░░░░░░░░░░░░░░░░░░░░░░░░\n"
|
||||
"░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▀░░░░░░░░░░░░░░░░░░░░░░░░░" << ENDL);
|
||||
" \n"
|
||||
" | __/| \n"
|
||||
" | @ @ WoW! \n"
|
||||
" | <> _ \n"
|
||||
" | _/|------____ ((| |)) \n"
|
||||
" | `--' | \n"
|
||||
" ____|_ ___| |___.' \n"
|
||||
" /_/_____/____/_______| \n"
|
||||
"########################################################\n"
|
||||
"### ____ ############ _ #### ____ ######################\n"
|
||||
"###| _ | __ _ _ __ | | __ | _ | ___ __ _ ___ ###\n"
|
||||
"###| | | |/ _` | '_ || |/ / | | | |/ _ | / _` |/ _ | ###\n"
|
||||
"###| |_| | (_| | | | | < | |_| | (_) | (_| | __/ ###\n"
|
||||
"###|____/ |__,_|_| |_|_||_| |____/ |___/ __, ||___| ###\n"
|
||||
"#########################################|___/##########\n"
|
||||
"########################################################"<< ENDL);
|
||||
MGINFO_YELLOW(ENDL << "**********************************************************************" << ENDL
|
||||
<< main_message << ENDL
|
||||
<< ENDL
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
|
||||
#define DEF_MONERO_VERSION "0.3.1.4"
|
||||
#define DEF_MONERO_RELEASE_NAME "Cool Cage"
|
||||
#define DEF_MONERO_VERSION "0.4.0.0"
|
||||
#define DEF_MONERO_RELEASE_NAME "Dank Doge"
|
||||
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
|
||||
|
||||
#include "version.h"
|
||||
|
Loading…
Reference in New Issue
Block a user