forked from such-gitea/wownero
Compare commits
14 Commits
release-v0
...
release-v0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ffda21600 | ||
|
|
41494095eb | ||
|
|
c33e7f7bbb | ||
|
|
1fa62a2a25 | ||
|
|
8894ff9381 | ||
|
|
59ac413283 | ||
|
|
db77810cd4 | ||
|
|
fc9d0deb38 | ||
|
|
698d041e64 | ||
|
|
7f28f73bd6 | ||
|
|
003f0b3af3 | ||
|
|
47bd60ba50 | ||
|
|
6e6cb4fdaf | ||
|
|
c299569449 |
@@ -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.
|
||||
|
||||
|
||||
88
installers/build-cli-win.py
Normal file
88
installers/build-cli-win.py
Normal file
@@ -0,0 +1,88 @@
|
||||
#
|
||||
# This is a script for easily building the wownero cli installer in an automated build. Note
|
||||
# that it is also possible to build the installer by dropping the .nsi file on the NSIS GUI,
|
||||
# but that this will not work, as the script requires some defines, parsed from the wownero
|
||||
# version file, to be passed on the command line.
|
||||
#
|
||||
|
||||
import sys
|
||||
sys.dont_write_bytecode = True
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
|
||||
#
|
||||
# Grab the dir of this .py
|
||||
#
|
||||
basedir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
#
|
||||
# Try to find version.cpp.in.
|
||||
#
|
||||
version_file = os.path.join('..', 'src', 'version.cpp.in')
|
||||
if not os.path.isfile(version_file):
|
||||
print('Version file not found: %s' % version_file)
|
||||
sys.exit(-1)
|
||||
|
||||
#
|
||||
# Try to parse version.cpp.in.
|
||||
#
|
||||
version_string = None
|
||||
release_name = None
|
||||
with open(version_file, 'r') as fp:
|
||||
version_prefix = '#define DEF_MONERO_VERSION "'
|
||||
release_prefix = '#define DEF_MONERO_RELEASE_NAME "'
|
||||
for line in fp:
|
||||
if line.startswith(version_prefix):
|
||||
version_string = line.replace(version_prefix, '')[:-2]
|
||||
elif line.startswith(release_prefix):
|
||||
release_name = line.replace(release_prefix, '')[:-2]
|
||||
|
||||
if not version_string:
|
||||
print('Failed to parse version from: %s' % version_file)
|
||||
sys.exit(-1)
|
||||
|
||||
if not release_name:
|
||||
print('Failed to parse release name from: %s' % version_file)
|
||||
sys.exit(-1)
|
||||
|
||||
#
|
||||
# Check that we got an expected version format.
|
||||
#
|
||||
version_parts = version_string.split('.')
|
||||
if len(version_parts) != 4:
|
||||
print('Invalid version string: %s' % version_string)
|
||||
sys.exit(-1)
|
||||
|
||||
#
|
||||
# Try to find makensis.
|
||||
#
|
||||
makensis = 'makensis.exe'
|
||||
if not os.path.isfile(makensis):
|
||||
for dir in os.environ['PATH'].split(';'):
|
||||
test = os.path.join(dir, makensis)
|
||||
if os.path.isfile(test):
|
||||
makensis = test
|
||||
break
|
||||
|
||||
if not os.path.isfile(makensis):
|
||||
print('Failed to find makensis.exe')
|
||||
sys.exit(-1)
|
||||
|
||||
#
|
||||
# Build & run makensis command line.
|
||||
#
|
||||
cmd = '"%s"' % makensis
|
||||
cmd += ' /V4'
|
||||
cmd += ' /DVERSION_MAJOR=%s' % version_parts[0]
|
||||
cmd += ' /DVERSION_MINOR=%s' % version_parts[1]
|
||||
cmd += ' /DVERSION_BUILD=%s' % version_parts[2]
|
||||
cmd += ' /DVERSION_REVISION=%s' % version_parts[3]
|
||||
cmd += ' /DRELEASE_NAME="%s"' % release_name
|
||||
cmd += ' "%s"' % os.path.join(basedir, 'cli-win', 'installer.nsi')
|
||||
|
||||
print("Calling makensis: %s" % cmd)
|
||||
|
||||
subprocess.call(cmd)
|
||||
|
||||
BIN
installers/cli-win/app.ico
Normal file
BIN
installers/cli-win/app.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 361 KiB |
BIN
installers/cli-win/header.bmp
Normal file
BIN
installers/cli-win/header.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
262
installers/cli-win/installer.nsi
Normal file
262
installers/cli-win/installer.nsi
Normal file
@@ -0,0 +1,262 @@
|
||||
;-----------------------------------------------------------------------------------------
|
||||
; File: Wownero CLI NSIS installer
|
||||
; Author: 0x000090
|
||||
; Date: 1 Dec 2018
|
||||
; License: WTFPL
|
||||
;-----------------------------------------------------------------------------------------
|
||||
;
|
||||
; DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
; Version 2, December 2004
|
||||
;
|
||||
; Copyright (C) 2018 Wownero Inc., a Monero Enterprise Alliance partner company
|
||||
;
|
||||
; DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
; TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
;
|
||||
; 0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
;
|
||||
;-----------------------------------------------------------------------------------------
|
||||
!include 'MUI2.nsh'
|
||||
!include 'TextFunc.nsh'
|
||||
!include 'WordFunc.nsh'
|
||||
!include 'Sections.nsh'
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
!ifndef VERSION_MAJOR
|
||||
!warning 'VERSION_MAJOR not defined!'
|
||||
Quit
|
||||
!endif
|
||||
|
||||
!ifndef VERSION_MINOR
|
||||
!warning 'VERSION_MINOR not defined!'
|
||||
Quit
|
||||
!endif
|
||||
|
||||
!ifndef VERSION_BUILD
|
||||
!warning 'VERSION_BUILD not defined!'
|
||||
Quit
|
||||
!endif
|
||||
|
||||
!ifndef VERSION_REVISION
|
||||
!warning 'VERSION_REVISION not defined!'
|
||||
Quit
|
||||
!endif
|
||||
|
||||
!ifndef RELEASE_NAME
|
||||
!warning 'RELEASE_NAME not defined!'
|
||||
Quit
|
||||
!endif
|
||||
|
||||
!define VERSION_SHORT '${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}'
|
||||
!define VERSION_LONG '${VERSION_SHORT}.${VERSION_REVISION}'
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
!define PROJECT_NAME 'Wownero'
|
||||
!define PRODUCT_NAME 'Wownero CLI'
|
||||
!define COMPANY_NAME 'Wownero Inc.'
|
||||
!define EXE_BASENAME 'wownero'
|
||||
!define HELP_URL 'http://wownero.org/#community'
|
||||
!define ABOUT_URL 'http://wownero.org/#about'
|
||||
!define SOURCE_DIR '..\..\build\release\bin'
|
||||
!define TARGET_DIR '..\..\build\installers'
|
||||
!define TARGET_PATH '${TARGET_DIR}\Wownero-CLI-${VERSION_LONG}-win.exe'
|
||||
!define INSTALL_SUBDIR 'cli'
|
||||
!define INSTALL_SIZE 181000
|
||||
!define UNINSTALLER_NAME 'uninstall.exe'
|
||||
!define REG_BASE 'Software\Microsoft\Windows\CurrentVersion\Uninstall'
|
||||
!define REG_KEY '${REG_BASE}\{E114584F-4E1B-4B2D-8B1C-69A188025E98}'
|
||||
!define /date CURRENT_YEAR '%Y'
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
!system 'if not exist "${TARGET_DIR}" md "${TARGET_DIR}"'
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
Name '${PRODUCT_NAME}'
|
||||
OutFile '${TARGET_PATH}'
|
||||
BrandingText '${PRODUCT_NAME} ${VERSION_LONG} "${RELEASE_NAME}"'
|
||||
CRCCheck force
|
||||
RequestExecutionLevel admin
|
||||
InstallDir "$PROGRAMFILES64\${PROJECT_NAME}\${INSTALL_SUBDIR}"
|
||||
ShowInstDetails show
|
||||
ShowUninstDetails show
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
VIAddVersionKey 'CompanyName' '${COMPANY_NAME}'
|
||||
VIAddVersionKey 'ProductName' '${PRODUCT_NAME}'
|
||||
VIAddVersionKey 'FileDescription' '${PRODUCT_NAME}'
|
||||
VIAddVersionKey 'LegalCopyright' 'Copyright (c) ${CURRENT_YEAR}, ${COMPANY_NAME}'
|
||||
VIAddVersionKey 'FileVersion' '${VERSION_SHORT}'
|
||||
VIProductVersion '${VERSION_LONG}'
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_UNABORTWARNING
|
||||
|
||||
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
||||
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
|
||||
|
||||
!define MUI_ICON "app.ico"
|
||||
!define MUI_UNICON "app.ico"
|
||||
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_HEADERIMAGE_RIGHT
|
||||
!define MUI_HEADERIMAGE_BITMAP "header.bmp"
|
||||
!define MUI_HEADERIMAGE_UNBITMAP "header.bmp"
|
||||
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
|
||||
!define MUI_HEADERIMAGE_UNBITMAP_NOSTRETCH
|
||||
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP "welcome.bmp"
|
||||
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "welcome.bmp"
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
|
||||
!define MUI_UNWELCOMEFINISHPAGE_UNBITMAP_NOSTRETCH
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_UNPAGE_WELCOME
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
Function VerifyUserIsAdmin
|
||||
UserInfo::GetAccountType
|
||||
Pop $0
|
||||
${If} $0 != "admin"
|
||||
MessageBox MB_ICONSTOP "Admin permissions required, please use right-click > Run as Administrator."
|
||||
SetErrorLevel 740 ; ERROR_ELEVATION_REQUIRED
|
||||
Quit
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function .onInit
|
||||
Call VerifyUserIsAdmin
|
||||
FunctionEnd
|
||||
|
||||
Function un.onInit
|
||||
FunctionEnd
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
!macro RemoveFile file
|
||||
Push $0
|
||||
${TrimNewLines} '${file}' $0
|
||||
SetDetailsPrint both
|
||||
${If} ${FileExists} '$0'
|
||||
DetailPrint 'Deleting file $0'
|
||||
SetDetailsPrint textonly
|
||||
Delete "$0"
|
||||
${Else}
|
||||
DetailPrint 'File not found: $0'
|
||||
${Endif}
|
||||
SetDetailsPrint lastused
|
||||
Pop $0
|
||||
!macroend
|
||||
|
||||
!macro RemoveDir dir
|
||||
Push $0
|
||||
${TrimNewLines} '${dir}' $0
|
||||
SetDetailsPrint both
|
||||
${If} ${FileExists} '$0'
|
||||
DetailPrint 'Deleting directory $0'
|
||||
SetDetailsPrint textonly
|
||||
RmDir /r "$0"
|
||||
${Else}
|
||||
DetailPrint 'Directory not found: $0'
|
||||
${Endif}
|
||||
SetDetailsPrint lastused
|
||||
Pop $0
|
||||
!macroend
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
Function WriteFiles
|
||||
DetailPrint 'Installing application files...'
|
||||
SetDetailsPrint both
|
||||
SetOutPath '$INSTDIR'
|
||||
File 'app.ico'
|
||||
|
||||
;
|
||||
; Add here whatever else you want to be included:
|
||||
;
|
||||
File '${SOURCE_DIR}\${EXE_BASENAME}d.exe'
|
||||
File '${SOURCE_DIR}\${EXE_BASENAME}-wallet-cli.exe'
|
||||
File '${SOURCE_DIR}\${EXE_BASENAME}-wallet-rpc.exe'
|
||||
File '${SOURCE_DIR}\${EXE_BASENAME}-gen-trusted-multisig.exe'
|
||||
|
||||
;
|
||||
; NOTE: you can also add all files in a dir, like this:
|
||||
;
|
||||
;File /r '${SOURCE_DIR}\*.*'
|
||||
|
||||
SetDetailsPrint lastused
|
||||
DetailPrint 'Writing uninstaller...'
|
||||
WriteUninstaller '$INSTDIR\${UNINSTALLER_NAME}'
|
||||
FunctionEnd
|
||||
|
||||
Function un.WriteFiles
|
||||
DetailPrint 'Removing application files...'
|
||||
!insertmacro RemoveDir '$INSTDIR'
|
||||
FunctionEnd
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
Function WriteShortcuts
|
||||
DetailPrint 'Creating Desktop shortcuts...'
|
||||
CreateShortCut '$DESKTOP\${PRODUCT_NAME} Wallet.lnk' '$INSTDIR\${EXE_BASENAME}-wallet-cli.exe' '' '$INSTDIR\app.ico'
|
||||
CreateShortCut '$DESKTOP\${PRODUCT_NAME} Daemon.lnk' '$INSTDIR\${EXE_BASENAME}d.exe' '' '$INSTDIR\app.ico'
|
||||
DetailPrint 'Creating Start Menu shortcuts...'
|
||||
CreateDirectory '$SMPROGRAMS\${COMPANY_NAME}\${PRODUCT_NAME}'
|
||||
CreateShortCut '$SMPROGRAMS\${COMPANY_NAME}\${PRODUCT_NAME}\${PRODUCT_NAME} Wallet.lnk' '$INSTDIR\${EXE_BASENAME}-wallet-cli.exe' '' '$INSTDIR\app.ico'
|
||||
CreateShortCut '$SMPROGRAMS\${COMPANY_NAME}\${PRODUCT_NAME}\${PRODUCT_NAME} Daemon.lnk' '$INSTDIR\${EXE_BASENAME}d.exe' '' '$INSTDIR\app.ico'
|
||||
CreateShortCut '$SMPROGRAMS\${COMPANY_NAME}\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk' '$INSTDIR\${UNINSTALLER_NAME}' '' '$INSTDIR\app.ico'
|
||||
FunctionEnd
|
||||
|
||||
Function un.WriteShortcuts
|
||||
DetailPrint 'Removing Desktop shortcuts...'
|
||||
!insertmacro RemoveFile '$DESKTOP\${PRODUCT_NAME} Daemon.lnk'
|
||||
!insertmacro RemoveFile '$DESKTOP\${PRODUCT_NAME} Wallet.lnk'
|
||||
DetailPrint 'Removing Start Menu shortcuts...'
|
||||
!insertmacro RemoveDir '$SMPROGRAMS\${COMPANY_NAME}\${PRODUCT_NAME}'
|
||||
FunctionEnd
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
Function WriteUninstaller
|
||||
DetailPrint 'Registering ${PRODUCT_NAME} ${VERSION_SHORT}'
|
||||
WriteRegDWORD HKLM '${REG_KEY}' 'VersionMajor' ${VERSION_MAJOR}
|
||||
WriteRegDWORD HKLM '${REG_KEY}' 'VersionMinor' ${VERSION_MINOR}
|
||||
WriteRegDWORD HKLM '${REG_KEY}' 'EstimatedSize' ${INSTALL_SIZE}
|
||||
WriteRegDWORD HKLM '${REG_KEY}' 'NoModify' 1
|
||||
WriteRegDWORD HKLM '${REG_KEY}' 'NoRepair' 1
|
||||
WriteRegStr HKLM '${REG_KEY}' 'Contact' '${COMPANY_NAME}'
|
||||
WriteRegStr HKLM '${REG_KEY}' 'Publisher' '${COMPANY_NAME}'
|
||||
WriteRegStr HKLM '${REG_KEY}' 'HelpLink' '${HELP_URL}'
|
||||
WriteRegStr HKLM '${REG_KEY}' 'URLInfoAbout' '${ABOUT_URL}'
|
||||
WriteRegStr HKLM '${REG_KEY}' 'DisplayVersion' '${VERSION_SHORT}'
|
||||
WriteRegStr HKLM '${REG_KEY}' 'Comments' '${PRODUCT_NAME}'
|
||||
WriteRegStr HKLM '${REG_KEY}' 'DisplayName' '${PRODUCT_NAME} ${VERSION_SHORT}'
|
||||
WriteRegStr HKLM '${REG_KEY}' 'InstallLocation' '"$INSTDIR"'
|
||||
WriteRegStr HKLM '${REG_KEY}' 'DisplayIcon' '"$INSTDIR\app.ico"'
|
||||
WriteRegStr HKLM '${REG_KEY}' 'UninstallString' '"$INSTDIR\${UNINSTALLER_NAME}"'
|
||||
WriteRegStr HKLM '${REG_KEY}' 'QuietUninstallString' '"$INSTDIR\${UNINSTALLER_NAME}" /S'
|
||||
FunctionEnd
|
||||
|
||||
Function un.WriteUninstaller
|
||||
DetailPrint 'Unregistering ${PRODUCT_NAME} ${VERSION_SHORT}...'
|
||||
DeleteRegKey HKLM '${REG_KEY}'
|
||||
FunctionEnd
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
Section "${PRODUCT_NAME} ${VERSION_SHORT}"
|
||||
Call WriteFiles
|
||||
Call WriteShortcuts
|
||||
Call WriteUninstaller
|
||||
SectionEnd
|
||||
|
||||
;-----------------------------------------------------------------------------------------
|
||||
Section "Uninstall"
|
||||
Call un.WriteFiles
|
||||
Call un.WriteShortcuts
|
||||
Call un.WriteUninstaller
|
||||
SectionEnd
|
||||
|
||||
BIN
installers/cli-win/welcome.bmp
Normal file
BIN
installers/cli-win/welcome.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 151 KiB |
31
installers/readme.txt
Normal file
31
installers/readme.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
Installer notes
|
||||
|
||||
So, at this point I just have one installer, for the cli, on windows. What do you need
|
||||
to know ..
|
||||
|
||||
1. It uses NSIS, and expects to find makensis.exe on your PATH.
|
||||
|
||||
2. It expects built products to be found at:
|
||||
|
||||
wownero/build/release/bin
|
||||
|
||||
3. It currently includes the daemon, wallet, rpc, and gen-trusted-multisig. I note that
|
||||
releases on the wownero github have had different files (static libs, pthreads dll)
|
||||
than I end up with in my /bin dir when I build, so you may or may not need to change
|
||||
which files you include. At any rate, it is easy to do, in the WriteFiles function
|
||||
in installer.nsi.
|
||||
|
||||
4. Provided everything is ok, it should be as simple as executing build-cli-win.py; built
|
||||
installer, versioned according to src/version.cpp.in, will be depostied here:
|
||||
|
||||
wownero/build/installers/Wownero-CLI-<version>-win.exe
|
||||
|
||||
5. The installer includes an uninstaller, shortcuts on desktop & start menu, and it
|
||||
registers itself with windows, so it shows up as expected in programs & features.
|
||||
|
||||
6. I have tried to keep the installer script pretty generic, so it can be reused later,
|
||||
for gui, or whatever. It installs to a <program files>/Wownero/cli subdirectory, so
|
||||
that other applications can eventually be installed alongside. NOTE: if you copy the
|
||||
installer.nsi file to use for another project, you will need to make a new GUID for
|
||||
it, and put it in the REG_KEY define.
|
||||
|
||||
Binary file not shown.
@@ -204,6 +204,12 @@ 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");
|
||||
ADD_CHECKPOINT(63469, "4e33a9343fc5b86661ec0affaeb5b5a065290602c02d817337e4a979fe5747d8"); //Hard fork to v10
|
||||
ADD_CHECKPOINT(63950, "155b61475985ac3f48fda10091d732bdc8087a55554504959e88d29962c91b72");
|
||||
ADD_CHECKPOINT(67500, "84acb8fa140d8c7eb49bcbcf662cbe7570496f463c637a67980613dbd70dbbc3");
|
||||
|
||||
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[] = "5aaafa48eb50fc5d8fa95b3a94da504170082245dd1f2d32ec7b72eb60877711";
|
||||
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.1"
|
||||
#define DEF_MONERO_RELEASE_NAME "Dank Doge"
|
||||
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
|
||||
|
||||
#include "version.h"
|
||||
|
||||
Reference in New Issue
Block a user