Merge pull request #379 from svost/c++11
authorCryptoManiac <CryptoManiac@users.noreply.github.com>
Tue, 21 Aug 2018 19:57:08 +0000 (22:57 +0300)
committerGitHub <noreply@github.com>
Tue, 21 Aug 2018 19:57:08 +0000 (22:57 +0300)
Rollup to svost current state.

51 files changed:
MSVC/libcommon/libcommon.vcxproj
MSVC/mynovacoin/mynovacoin.vcxproj
MSVC/mynovacoinqt/mynovacoinqt.vcxproj
doc/building novacoind and novacoinqt under Windows with MinGW.txt
doc/crosscompiling_building Windows binary under Unix.txt
novacoin-qt.pro
src/addrman.h
src/alert.cpp
src/alert.h
src/base58.cpp
src/bignum.h
src/bitcoinrpc.cpp
src/bitcoinrpc.h
src/crypter.cpp
src/init.cpp
src/irc.cpp
src/key.cpp
src/key.h
src/main.cpp
src/main.h
src/makefile.bsd
src/makefile.linux-mingw
src/makefile.mingw
src/makefile.osx
src/makefile.unix
src/net.cpp
src/net.h
src/netbase.cpp
src/netbase.h
src/qt/bitcoin.cpp
src/qt/coincontroldialog.cpp
src/qt/forms/rpcconsole.ui
src/qt/intro.cpp
src/qt/intro.h
src/qt/optionsmodel.cpp
src/qt/rpcconsole.cpp
src/qt/rpcconsole.h
src/qt/transactiondesc.cpp
src/qt/transactionrecord.cpp
src/rpcblockchain.cpp
src/rpcnet.cpp
src/rpcwallet.cpp
src/timedata.cpp [new file with mode: 0644]
src/timedata.h [new file with mode: 0644]
src/uint256.cpp
src/uint256.h
src/util.cpp
src/util.h
src/version.cpp
src/wallet.cpp
src/wallet.h

index 90fb6da..97cdda1 100644 (file)
@@ -23,6 +23,7 @@
     <ClCompile Include="..\..\src\cryptogram.cpp" />
     <ClCompile Include="..\..\src\ecies.cpp" />
     <ClCompile Include="..\..\src\ipcollector.cpp" />
+    <ClCompile Include="..\..\src\timedata.cpp" />
     <ClCompile Include="..\..\src\kernel.cpp" />
     <ClCompile Include="..\..\src\kernel_worker.cpp" />
     <ClCompile Include="..\..\src\rpccrypt.cpp" />
@@ -83,6 +84,7 @@
     <ClInclude Include="..\..\src\init.h" />
     <ClInclude Include="..\..\src\inttypes.h" />
     <ClInclude Include="..\..\src\ipcollector.h" />
+    <ClCompile Include="..\..\src\timedata.h" />
     <ClInclude Include="..\..\src\irc.h" />
     <ClInclude Include="..\..\src\kernel_worker.h" />
     <ClInclude Include="..\..\src\key.h" />
       <PrecompiledHeader>NotUsing</PrecompiledHeader>
       <WarningLevel>Level1</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>STATICLIB;_CRT_SECURE_NO_WARNINGS;UNICODE;WIN32;_SCL_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;HAVE_WORKING_BOOST_SLEEP_FOR;NOMINMAX;USE_LEVELDB;USE_IPV6=1;BOOST_SPIRIT_THREADSAFE;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>STATICLIB;_CRT_SECURE_NO_WARNINGS;UNICODE;WIN32;_SCL_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;HAVE_WORKING_BOOST_SLEEP_FOR;NOMINMAX;USE_LEVELDB;BOOST_SPIRIT_THREADSAFE;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\include;..\..\..\Deps;..\..\..\deps\openssl-1.0.2\inc32;..\..\..\src\leveldb\helpers\memenv;..\..\src\leveldb\helpers;..\..\src\leveldb\include;..\..\..\deps\db-6.0.20\build_windows;..\..\..\deps\boost_1_57_0;..\..\..\deps\boost_1_57_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       </PrecompiledHeader>
       <WarningLevel>Level1</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>STATICLIB;_CRT_SECURE_NO_WARNINGS;UNICODE;WIN32;_WIN32;_SCL_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;HAVE_WORKING_BOOST_SLEEP_FOR;NOMINMAX;USE_LEVELDB;USE_IPV6=1;BOOST_SPIRIT_THREADSAFE;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>STATICLIB;_CRT_SECURE_NO_WARNINGS;UNICODE;WIN32;_WIN32;_SCL_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;HAVE_WORKING_BOOST_SLEEP_FOR;NOMINMAX;USE_LEVELDB;BOOST_SPIRIT_THREADSAFE;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\include;..\..\..\Deps;..\..\..\deps\openssl-1.0.2\inc32;..\..\..\src\leveldb\helpers\memenv;..\..\src\leveldb\helpers;..\..\src\leveldb\include;..\..\..\deps\db-6.0.20\build_windows;..\..\..\deps\boost_1_57_0;..\..\..\deps\boost_1_57_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>STATICLIB;_CRT_SECURE_NO_WARNINGS;UNICODE;WIN32;_SCL_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;HAVE_WORKING_BOOST_SLEEP_FOR;NOMINMAX;USE_LEVELDB;USE_IPV6=1;BOOST_SPIRIT_THREADSAFE;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>STATICLIB;_CRT_SECURE_NO_WARNINGS;UNICODE;WIN32;_SCL_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;HAVE_WORKING_BOOST_SLEEP_FOR;NOMINMAX;USE_LEVELDB;BOOST_SPIRIT_THREADSAFE;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\include;..\..\..\deps\;..\..\..\deps\openssl-1.0.2\inc32;..\..\..\src\leveldb\helpers\memenv;..\..\src\leveldb\helpers;..\..\src\leveldb\include;..\..\..\deps\db-6.0.20\build_windows;..\..\..\deps\boost_1_57_0;..\..\..\deps\boost_1_57_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
       <TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>STATICLIB;_CRT_SECURE_NO_WARNINGS;UNICODE;WIN32;_SCL_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;HAVE_WORKING_BOOST_SLEEP_FOR;NOMINMAX;USE_LEVELDB;USE_IPV6=1;BOOST_SPIRIT_THREADSAFE;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>STATICLIB;_CRT_SECURE_NO_WARNINGS;UNICODE;WIN32;_SCL_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;HAVE_WORKING_BOOST_SLEEP_FOR;NOMINMAX;USE_LEVELDB;BOOST_SPIRIT_THREADSAFE;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\include;..\..\..\Deps;..\..\..\deps\openssl-1.0.2\inc32;..\..\..\src\leveldb\helpers\memenv;..\..\src\leveldb\helpers;..\..\src\leveldb\include;..\..\..\deps\db-6.0.20\build_windows;..\..\..\deps\boost_1_57_0;..\..\..\deps\boost_1_57_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
       <TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
index 3e9f2ff..eb22d7b 100644 (file)
@@ -86,7 +86,7 @@
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
-      <PreprocessorDefinitions>UNICODE;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>UNICODE;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\include;..\..\src\leveldb\include;..\..\..\deps\openssl-1.0.2\inc32;..\..\..\deps\db-6.0.20\build_windows;..\..\..\deps\boost_1_57_0;..\..\..\deps\boost_1_57_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <Optimization>Disabled</Optimization>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <ClCompile>
-      <PreprocessorDefinitions>UNICODE;WIN32;_WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>UNICODE;WIN32;_WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\include;..\..\src\leveldb\include;..\..\..\Deps\openssl-1.0.2\inc32;..\..\..\Deps\db-6.0.20\build_windows;..\..\..\Deps\boost_1_57_0;..\..\..\Deps\boost_1_57_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <Optimization>Disabled</Optimization>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
-      <PreprocessorDefinitions>UNICODE;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>UNICODE;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\include;..\..\src\leveldb\include;..\..\..\deps\openssl-1.0.2\inc32;..\..\..\deps\db-6.0.20\build_windows;..\..\..\deps\boost_1_57_0;..\..\..\deps\boost_1_57_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <ClCompile>
-      <PreprocessorDefinitions>UNICODE;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>UNICODE;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\include;..\..\src\leveldb\include;..\..\..\Deps\openssl-1.0.2\inc32;..\..\..\Deps\db-6.0.20\build_windows;..\..\..\Deps\boost_1_57_0;..\..\..\Deps\boost_1_57_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
index d8f70c9..be377e7 100644 (file)
       <ExceptionHandling>Sync</ExceptionHandling>
       <ObjectFileName>$(IntDir)</ObjectFileName>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>UNICODE;WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;QT_GUI;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>UNICODE;WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;QT_GUI;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessToFile>false</PreprocessToFile>
       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
       <SuppressStartupBanner>true</SuppressStartupBanner>
@@ -157,7 +157,7 @@ C:\MyProjects\Deps\qt-everywhere-opensource-src-5.3.2\qtbase\bin\moc.exe C:\MyPr
       <ExceptionHandling>Sync</ExceptionHandling>
       <ObjectFileName>$(IntDir)</ObjectFileName>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>UNICODE;WIN32;_WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;QT_GUI;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>UNICODE;WIN32;_WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;QT_GUI;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessToFile>false</PreprocessToFile>
       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
       <SuppressStartupBanner>true</SuppressStartupBanner>
@@ -211,7 +211,7 @@ C:\MyProjects\Deps\qt-everywhere-opensource-src-5.3.2-64\qtbase\bin\moc.exe C:\M
       <ExceptionHandling>Sync</ExceptionHandling>
       <ObjectFileName>$(IntDir)</ObjectFileName>
       <Optimization>Full</Optimization>
-      <PreprocessorDefinitions>UNICODE;WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;QT_GUI;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>UNICODE;WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;QT_GUI;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessToFile>false</PreprocessToFile>
       <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -269,7 +269,7 @@ C:\MyProjects\Deps\qt-everywhere-opensource-src-5.3.2\qtbase\bin\moc.exe C:\MyPr
       <ExceptionHandling>Sync</ExceptionHandling>
       <ObjectFileName>$(IntDir)</ObjectFileName>
       <Optimization>Full</Optimization>
-      <PreprocessorDefinitions>UNICODE;WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;QT_GUI;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>UNICODE;WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;QT_GUI;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;USE_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessToFile>false</PreprocessToFile>
       <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
index 885b7fb..98d7beb 100644 (file)
@@ -187,7 +187,7 @@ LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -static
 USE_LEVELDB:=0 
 на
 USE_LEVELDB:=1
-(выше USE_IPV6:=1)
+
 Так же измените 
 cd leveldb; make; cd ..
 на 
@@ -272,7 +272,7 @@ Qt5 + транзакционный индекс BDB
 
 set PATH=%PATH%;C:\Qt\5.4.0\bin
 cd C:\MyProjects\novacoin-master
-qmake "USE_IPV6=1" "USE_ASM=1" novacoin-qt.pro
+qmake "USE_ASM=1" novacoin-qt.pro
 mingw32-make -f Makefile.Release
 
 
@@ -280,21 +280,21 @@ Qt5 + транзакционный индекс LevelDB
 
 set PATH=%PATH%;C:\Qt\5.4.0\bin
 cd C:\MyProjects\novacoin-master
-qmake "USE_IPV6=1" "USE_LEVELDB=1" "USE_ASM=1" novacoin-qt.pro
+qmake "USE_LEVELDB=1" "USE_ASM=1" novacoin-qt.pro
 mingw32-make -f Makefile.Release
 
 Qt4 + транзакционный индекс BDB
 
 set PATH=%PATH%;C:\Qt\4.8.6\bin
 cd C:\MyProjects\novacoin-master
-qmake "USE_IPV6=1" "USE_ASM=1" novacoin-qt.pro
+qmake "USE_ASM=1" novacoin-qt.pro
 mingw32-make -f Makefile.Release
 
 Qt4 + транзакционный индекс LevelDB
 
 set PATH=%PATH%;C:\Qt\4.8.6\bin
 cd C:\MyProjects\novacoin-master
-qmake "USE_IPV6=1" "USE_LEVELDB=1" "USE_ASM=1" novacoin-qt.pro
+qmake "USE_LEVELDB=1" "USE_ASM=1" novacoin-qt.pro
 mingw32-make -f Makefile.Release
 
 
@@ -467,7 +467,7 @@ Qt5 + транзакционный индекс BDB
 
 set PATH=%PATH%;C:\Qt\5.4.0-x64\bin
 cd C:\MyProjects\novacoin-master
-qmake "USE_IPV6=1" "USE_ASM=1" novacoin-qt64.pro
+qmake "USE_ASM=1" novacoin-qt64.pro
 mingw32-make -f Makefile.Release
 
 
@@ -475,21 +475,21 @@ Qt5 + транзакционный индекс LevelDB
 
 set PATH=%PATH%;C:\Qt\5.4.0-x64\bin
 cd C:\MyProjects\novacoin-master
-qmake "USE_IPV6=1" "USE_LEVELDB=1" "USE_ASM=1" novacoin-qt64.pro
+qmake "USE_LEVELDB=1" "USE_ASM=1" novacoin-qt64.pro
 mingw32-make -f Makefile.Release
 
 Qt4 + транзакционный индекс BDB
 
 set PATH=%PATH%;C:\Qt\4.8.6-x64\bin
 cd C:\MyProjects\novacoin-master
-qmake "USE_IPV6=1" "USE_ASM=1" novacoin-qt64.pro
+qmake "USE_ASM=1" novacoin-qt64.pro
 mingw32-make -f Makefile.Release
 
 Qt4 + транзакционный индекс LevelDB
 
 set PATH=%PATH%;C:\Qt\4.8.6-x64\bin
 cd C:\MyProjects\novacoin-master
-qmake "USE_IPV6=1" "USE_LEVELDB=1" "USE_ASM=1" novacoin-qt64.pro
+qmake "USE_LEVELDB=1" "USE_ASM=1" novacoin-qt64.pro
 mingw32-make -f Makefile.Release
 
 Если всё сделано правильно, то файл novacoin-qt.exe будет находится в папке C:\MyProjects\novacoin-master\release
index 5c0a38e..90aef48 100644 (file)
@@ -170,7 +170,7 @@ $(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
 USE_LEVELDB:=0 
 на
 USE_LEVELDB:=1
-(выше USE_IPV6:=1)
+
 Откройте файл /home/<ваше имя>/novacoin/src/leveldb/Makefile
 Вставьте ниже строчки CXXFLAGS += -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT) следующие строки:
 
@@ -263,28 +263,28 @@ Qt4 + транзакционный индекс LevelDB
 
 export PATH=/home/<ваше имя>/mxe/usr/bin:$PATH
 cd /home/<ваше имя>/novacoin
-i686-w64-mingw32.static-qmake-qt4 "USE_IPV6=1" "USE_LEVELDB=1" "USE_ASM=1" novacoin-qt.pro
+i686-w64-mingw32.static-qmake-qt4 "USE_LEVELDB=1" "USE_ASM=1" novacoin-qt.pro
 make -j n -f Makefile.Release  (вместо n количество ядер вашего процессора, которые вы хотите выделить под сборку)
 
 Qt4 + транзакционный индекс BDB
 
 export PATH=/home/<ваше имя>/mxe/usr/bin:$PATH
 cd /home/<ваше имя>/novacoin
-i686-w64-mingw32.static-qmake-qt4 "USE_IPV6=1" "USE_ASM=1" novacoin-qt.pro
+i686-w64-mingw32.static-qmake-qt4 "USE_ASM=1" novacoin-qt.pro
 make -j n -f Makefile.Release  (вместо n количество ядер вашего процессора, которые вы хотите выделить под сборку)
 
 Qt5 + транзакционный индекс LevelDB
 
 export PATH=/home/<ваше имя>/mxe/usr/bin:$PATH
 cd /home/<ваше имя>/novacoin
-i686-w64-mingw32.static-qmake-qt5 "USE_IPV6=1" "USE_LEVELDB=1" "USE_ASM=1" novacoin-qt.pro
+i686-w64-mingw32.static-qmake-qt5 "USE_LEVELDB=1" "USE_ASM=1" novacoin-qt.pro
 make -j n -f Makefile.Release  (вместо n количество ядер вашего процессора, которые вы хотите выделить под сборку)
 
 Qt5 + транзакционный индекс BDB
 
 export PATH=/home/<ваше имя>/mxe/usr/bin:$PATH
 cd /home/<ваше имя>/novacoin
-i686-w64-mingw32.static-qmake-qt5 "USE_IPV6=1" "USE_ASM=1" novacoin-qt.pro
+i686-w64-mingw32.static-qmake-qt5 "USE_ASM=1" novacoin-qt.pro
 make -j n -f Makefile.Release  (вместо n количество ядер вашего процессора, которые вы хотите выделить под сборку)
 
 
index 44c1bcd..d68cca5 100644 (file)
@@ -92,18 +92,6 @@ contains(USE_DBUS, 1) {
     QT += dbus
 }
 
-# use: qmake "USE_IPV6=1" ( enabled by default; default)
-#  or: qmake "USE_IPV6=0" (disabled by default)
-#  or: qmake "USE_IPV6=-" (not supported)
-contains(USE_IPV6, -) {
-    message(Building without IPv6 support)
-} else {
-    count(USE_IPV6, 0) {
-        USE_IPV6=1
-    }
-    DEFINES += USE_IPV6=$$USE_IPV6
-}
-
 contains(BITCOIN_NEED_QT_PLUGINS, 1) {
     DEFINES += BITCOIN_NEED_QT_PLUGINS
     QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs qtaccessiblewidgets
@@ -282,7 +270,8 @@ HEADERS += src/qt/bitcoingui.h \
     src/qt/multisigdialog.h \
     src/qt/secondauthdialog.h \
     src/ies.h \
-    src/ipcollector.h
+    src/ipcollector.h \
+    src/timedata.h
 
 SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \
     src/qt/intro.cpp \
@@ -366,7 +355,8 @@ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \
     src/uint256.cpp \
     src/ecies.cpp \
     src/ipcollector.cpp \
-    src/serialize.cpp
+    src/serialize.cpp \
+    src/timedata.cpp
 
 
 RESOURCES += \
index 054c1db..43466d6 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "netbase.h"
 #include "protocol.h"
+#include "timedata.h"
 #include "util.h"
 #include "sync.h"
 
index 619cc52..6c2205a 100644 (file)
@@ -8,6 +8,7 @@
 #include "key.h"
 #include "net.h"
 #include "sync.h"
+#include "timedata.h"
 #include "ui_interface.h"
 
 using namespace std;
index ad7d381..547b314 100644 (file)
@@ -9,6 +9,7 @@
 #include <set>
 #include <string>
 
+#include "serialize.h"
 #include "uint256.h"
 #include "util.h"
 
index 29591b3..da2f197 100644 (file)
@@ -352,6 +352,7 @@ bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRe
             CMalleablePubKey mPubKey;
             mPubKey.setvch(vchData);
             keyID = mPubKey.GetID();
+            return true;
         }
         default: return false;
         }
index 441c960..c313289 100644 (file)
@@ -7,8 +7,12 @@
 
 #include <stdexcept>
 #include <vector>
+
 #include <openssl/bn.h>
+
+#include "serialize.h"
 #include "util.h"
+#include "uint256.h"
 
 /** Errors thrown by the bignum class */
 class bignum_error : public std::runtime_error
index 0c7e278..a5fa4ac 100644 (file)
@@ -20,7 +20,6 @@
 #include <boost/iostreams/concepts.hpp>
 #include <boost/iostreams/stream.hpp>
 #include <boost/algorithm/string.hpp>
-#include <boost/lexical_cast.hpp>
 #include <boost/asio/ssl.hpp>
 #include <boost/filesystem/fstream.hpp>
 #include <boost/shared_ptr.hpp>
@@ -236,8 +235,8 @@ Value stop(const Array& params, bool fHelp)
 static const CRPCCommand vRPCCommands[] =
 { //  name                      function                 safemd  unlocked
   //  ------------------------  -----------------------  ------  --------
-    { "help",                       &help,                        true,   true },
-    { "stop",                       &stop,                        true,   true },
+    { "help",                       &help,                        true,   true  },
+    { "stop",                       &stop,                        true,   true  },
     { "getbestblockhash",           &getbestblockhash,            true,   false },
     { "getblockcount",              &getblockcount,               true,   false },
     { "getconnectioncount",         &getconnectioncount,          true,   false },
@@ -249,10 +248,11 @@ static const CRPCCommand vRPCCommands[] =
     { "getinfo",                    &getinfo,                     true,   false },
     { "getsubsidy",                 &getsubsidy,                  true,   false },
     { "getmininginfo",              &getmininginfo,               true,   false },
-    { "scaninput",                  &scaninput,                   true,   true },
+    { "scaninput",                  &scaninput,                   true,   true  },
     { "getnewaddress",              &getnewaddress,               true,   false },
     { "getnettotals",               &getnettotals,                true,   true  },
     { "ntptime",                    &ntptime,                     true,   true  },
+    { "getnetworkinfo",             &getnetworkinfo,              true,   false },
     { "getaccountaddress",          &getaccountaddress,           true,   false },
     { "setaccount",                 &setaccount,                  true,   false },
     { "getaccount",                 &getaccount,                  false,  false },
@@ -728,7 +728,7 @@ static void RPCListen(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketA
                 boost::ref(context),
                 fUseSSL,
                 conn,
-                boost::asio::placeholders::error));
+                _1));
 }
 
 /**
@@ -754,6 +754,8 @@ static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol,
     if (error)
     {
         delete conn;
+        // TODO: Actually handle errors
+        printf("%s: Error: %s\n", __func__, error.message().c_str());
     }
 
     // Restrict callers by IP.  It is important to
@@ -1109,6 +1111,16 @@ json_spirit::Value CRPCTable::execute(const std::string &strMethod, const json_s
     }
 }
 
+std::vector<std::string> CRPCTable::listCommands() const
+{
+    std::vector<std::string> commandList;
+    typedef std::map<std::string, const CRPCCommand*> commandMap;
+
+    std::transform( mapCommands.begin(), mapCommands.end(),
+                   std::back_inserter(commandList),
+                   boost::bind(&commandMap::value_type::first,_1) );
+    return commandList;
+}
 
 Object CallRPC(const string& strMethod, const Array& params)
 {
index a5888a9..0923ad4 100644 (file)
@@ -119,6 +119,11 @@ public:
      * @throws an exception (json_spirit::Value) when an error happens.
      */
     json_spirit::Value execute(const std::string &method, const json_spirit::Array &params) const;
+    /**
+    * Returns a list of registered commands
+    * @returns List of registered commands.
+    */
+    std::vector<std::string> listCommands() const;
 };
 
 extern const CRPCTable tableRPC;
@@ -157,6 +162,7 @@ extern json_spirit::Value importaddress(const json_spirit::Array& params, bool f
 extern json_spirit::Value removeaddress(const json_spirit::Array& params, bool fHelp);
 extern json_spirit::Value getnettotals(const json_spirit::Array& params, bool fHelp);
 extern json_spirit::Value ntptime(const json_spirit::Array& params, bool fHelp);
+extern json_spirit::Value getnetworkinfo(const json_spirit::Array& params, bool fHelp);
 
 extern json_spirit::Value sendalert(const json_spirit::Array& params, bool fHelp);
 
index ae2b0f4..77fc6bb 100644 (file)
@@ -2,16 +2,11 @@
 // Distributed under the MIT/X11 software license, see the accompanying
 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
 
-#include <openssl/aes.h>
 #include <openssl/evp.h>
-#include <vector>
-#include <string>
 
 #include "crypter.h"
 
-#ifdef WIN32
-#include <windows.h>
-#endif
+using namespace std;
 
 //
 //CMasterKey
@@ -23,14 +18,14 @@ CMasterKey::CMasterKey()
     // ie slightly lower than the lowest hardware we need bother supporting
     nDeriveIterations = 25000;
     nDerivationMethod = 0;
-    vchOtherDerivationParameters = std::vector<unsigned char>(0);
+    vchOtherDerivationParameters = vector<unsigned char>(0);
 }
 
 //
 //CCrypter
 //
 
-bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::vector<unsigned char>& chSalt, const unsigned int nRounds, const unsigned int nDerivationMethod)
+bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const vector<unsigned char>& chSalt, const unsigned int nRounds, const unsigned int nDerivationMethod)
 {
     if (nRounds < 1 || chSalt.size() != WALLET_CRYPTO_SALT_SIZE)
         return false;
@@ -53,7 +48,7 @@ bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::v
     return true;
 }
 
-bool CCrypter::SetKey(const CKeyingMaterial& chNewKey, const std::vector<unsigned char>& chNewIV)
+bool CCrypter::SetKey(const CKeyingMaterial& chNewKey, const vector<unsigned char>& chNewIV)
 {
     if (chNewKey.size() != WALLET_CRYPTO_KEY_SIZE || chNewIV.size() != WALLET_CRYPTO_KEY_SIZE)
         return false;
@@ -65,16 +60,18 @@ bool CCrypter::SetKey(const CKeyingMaterial& chNewKey, const std::vector<unsigne
     return true;
 }
 
-bool CCrypter::Encrypt(const CKeyingMaterial& vchPlaintext, std::vector<unsigned char> &vchCiphertext)
+bool CCrypter::Encrypt(const CKeyingMaterial& vchPlaintext, vector<unsigned char> &vchCiphertext)
 {
     if (!fKeySet)
         return false;
 
+    const int AES_BLOCK_SIZE = 16; // taken from <openssl/aes.h>
+
     // max ciphertext len for a n bytes of plaintext is
     // n + AES_BLOCK_SIZE - 1 bytes
     int nLen = vchPlaintext.size();
     int nCLen = nLen + AES_BLOCK_SIZE, nFLen = 0;
-    vchCiphertext = std::vector<unsigned char> (nCLen);
+    vchCiphertext = vector<unsigned char> (nCLen);
 
     EVP_CIPHER_CTX ctx;
 
@@ -92,7 +89,7 @@ bool CCrypter::Encrypt(const CKeyingMaterial& vchPlaintext, std::vector<unsigned
     return true;
 }
 
-bool CCrypter::Decrypt(const std::vector<unsigned char>& vchCiphertext, CKeyingMaterial& vchPlaintext)
+bool CCrypter::Decrypt(const vector<unsigned char>& vchCiphertext, CKeyingMaterial& vchPlaintext)
 {
     if (!fKeySet)
         return false;
@@ -145,20 +142,20 @@ CCrypter::~CCrypter()
     LockedPageManager::instance.UnlockRange(&chIV[0], sizeof chIV);
 }
 
-bool EncryptSecret(CKeyingMaterial& vMasterKey, const CSecret &vchPlaintext, const uint256& nIV, std::vector<unsigned char> &vchCiphertext)
+bool EncryptSecret(CKeyingMaterial& vMasterKey, const CSecret &vchPlaintext, const uint256& nIV, vector<unsigned char> &vchCiphertext)
 {
     CCrypter cKeyCrypter;
-    std::vector<unsigned char> chIV(WALLET_CRYPTO_KEY_SIZE);
+    vector<unsigned char> chIV(WALLET_CRYPTO_KEY_SIZE);
     memcpy(&chIV[0], &nIV, WALLET_CRYPTO_KEY_SIZE);
     if(!cKeyCrypter.SetKey(vMasterKey, chIV))
         return false;
     return cKeyCrypter.Encrypt((CKeyingMaterial)vchPlaintext, vchCiphertext);
 }
 
-bool DecryptSecret(const CKeyingMaterial& vMasterKey, const std::vector<unsigned char>& vchCiphertext, const uint256& nIV, CSecret& vchPlaintext)
+bool DecryptSecret(const CKeyingMaterial& vMasterKey, const vector<unsigned char>& vchCiphertext, const uint256& nIV, CSecret& vchPlaintext)
 {
     CCrypter cKeyCrypter;
-    std::vector<unsigned char> chIV(WALLET_CRYPTO_KEY_SIZE);
+    vector<unsigned char> chIV(WALLET_CRYPTO_KEY_SIZE);
     memcpy(&chIV[0], &nIV, WALLET_CRYPTO_KEY_SIZE);
     if(!cKeyCrypter.SetKey(vMasterKey, chIV))
         return false;
index 4b64d35..eef524f 100644 (file)
@@ -24,7 +24,6 @@
 
 
 using namespace std;
-using namespace boost;
 
 CWallet* pwalletMain;
 CClientUIInterface uiInterface;
@@ -321,21 +320,21 @@ bool DropBlockIndex()
     try
     {
 #ifdef USE_LEVELDB
-        filesystem::path directory = GetDataDir() / "txleveldb";
-        filesystem::remove_all(directory); // remove directory
+        boost::filesystem::path directory = GetDataDir() / "txleveldb";
+        boost::filesystem::remove_all(directory); // remove directory
 #else
-        filesystem::path indexFile = GetDataDir() / "blkindex.dat";
-        filesystem::remove(indexFile); // remove index file
+        boost::filesystem::path indexFile = GetDataDir() / "blkindex.dat";
+        boost::filesystem::remove(indexFile); // remove index file
 #endif
 
         unsigned int nFile = 1;
         for ( ; ; )
         {
-            filesystem::path strBlockFile = GetDataDir() / strprintf("blk%04u.dat", nFile);
+            boost::filesystem::path strBlockFile = GetDataDir() / strprintf("blk%04u.dat", nFile);
             // Break if no such file
-            if( !filesystem::exists( strBlockFile ) )
+            if( !boost::filesystem::exists( strBlockFile ) )
                 break;
-            filesystem::remove(strBlockFile);
+            boost::filesystem::remove(strBlockFile);
             nFile++;
         }
         return true;
@@ -611,7 +610,7 @@ bool AppInit2()
             return false;
     }
 
-    if (filesystem::exists(GetDataDir() / strWalletFileName))
+    if (boost::filesystem::exists(GetDataDir() / strWalletFileName))
     {
         CDBEnv::VerifyResult r = bitdb.Verify(strWalletFileName, CWalletDB::Recover);
         if (r == CDBEnv::RECOVER_OK)
@@ -642,12 +641,6 @@ bool AppInit2()
                 SetLimited(net);
         }
     }
-#if defined(USE_IPV6)
-#if ! USE_IPV6
-    else
-        SetLimited(NET_IPV6);
-#endif
-#endif
 
     CService addrProxy;
     bool fProxy = false;
@@ -658,10 +651,8 @@ bool AppInit2()
 
         if (!IsLimited(NET_IPV4))
             SetProxy(NET_IPV4, addrProxy);
-#ifdef USE_IPV6
             if (!IsLimited(NET_IPV6))
                 SetProxy(NET_IPV6, addrProxy);
-#endif
             SetNameProxy(addrProxy);
         fProxy = true;
     }
@@ -682,19 +673,19 @@ bool AppInit2()
     // see Step 2: parameter interactions for more information about these
     if (!IsLimited(NET_IPV4) || !IsLimited(NET_IPV6))
     {
-        fNoListen = !GetBoolArg("-listen", true);
+        fListen = GetBoolArg("-listen", true);
         fDiscover = GetBoolArg("-discover", true);
         fNameLookup = GetBoolArg("-dns", true);
     } else {
         // Don't listen, discover addresses or search for nodes if IPv4 and IPv6 networking is disabled.
-        fNoListen = true;
+        fListen = false;
         fDiscover = fNameLookup = false;
         SoftSetBoolArg("-irc", false);
         SoftSetBoolArg("-dnsseed", false);
     }
 
     bool fBound = false;
-    if (!fNoListen)
+    if (fListen)
     {
         if (mapArgs.count("-bind")) {
             for(std::string strBind :  mapMultiArgs["-bind"]) {
@@ -706,10 +697,8 @@ bool AppInit2()
         } else {
             struct in_addr inaddr_any;
             inaddr_any.s_addr = INADDR_ANY;
-#ifdef USE_IPV6
             if (!IsLimited(NET_IPV6))
                 fBound |= Bind(CService(in6addr_any, GetListenPort()), false);
-#endif
             if (!IsLimited(NET_IPV4))
                 fBound |= Bind(CService(inaddr_any, GetListenPort()), !fBound);
 
@@ -725,10 +714,8 @@ bool AppInit2()
         struct in_addr inaddr_loopback;
         inaddr_loopback.s_addr = htonl(INADDR_LOOPBACK);
 
-#ifdef USE_IPV6
         if (!BindListenPort(CService(in6addr_loopback, GetListenPort()), strError))
             return InitError(strError);
-#endif
         if (!BindListenPort(CService(inaddr_loopback, GetListenPort()), strError))
             return InitError(strError);
     }
@@ -969,13 +956,13 @@ bool AppInit2()
         StartShutdown();
     }
 
-    filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat";
-    if (filesystem::exists(pathBootstrap)) {
+    boost::filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat";
+    if (boost::filesystem::exists(pathBootstrap)) {
         uiInterface.InitMessage(_("Importing bootstrap blockchain data file."));
 
         FILE *file = fopen(pathBootstrap.string().c_str(), "rb");
         if (file) {
-            filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
+            boost::filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
             LoadExternalBlockFile(file, uiInterface);
             RenameOver(pathBootstrap, pathBootstrapOld);
         }
index bc1cb31..6e2a854 100644 (file)
@@ -210,7 +210,7 @@ void ThreadIRCSeed2(void* parg)
         return;
 
     // ... or if we won't make outbound connections and won't accept inbound ones.
-    if (mapArgs.count("-connect") && fNoListen)
+    if (mapArgs.count("-connect") && !fListen)
         return;
 
     // ... or if IRC is not enabled.
@@ -258,7 +258,7 @@ void ThreadIRCSeed2(void* parg)
         string strMyName;
         // Don't use our IP as our nick if we're not listening
         // or if it keeps failing because the nick is already in use.
-        if (!fNoListen && GetLocal(addrLocal, &addrIPv4) && nNameRetry<3)
+        if (fListen && GetLocal(addrLocal, &addrIPv4) && nNameRetry<3)
             strMyName = EncodeAddress(GetLocalAddress(&addrConnect));
         if (strMyName.empty())
             strMyName = strprintf("x%" PRIu64 "", GetRand(1000000000));
@@ -294,7 +294,7 @@ void ThreadIRCSeed2(void* parg)
         {
             printf("GetIPFromIRC() returned %s\n", addrFromIRC.ToString().c_str());
             // Don't use our IP as our nick if we're not listening
-            if (!fNoListen && addrFromIRC.IsRoutable())
+            if (fListen && addrFromIRC.IsRoutable())
             {
                 // IRC lets you to re-nick
                 AddLocal(addrFromIRC, LOCAL_IRC);
index 3c4762e..52bd93e 100644 (file)
@@ -535,14 +535,6 @@ bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchS
     return ret;
 }
 
-bool CPubKey::VerifyCompact(const uint256 &hash, const std::vector<unsigned char>& vchSig)
-{
-    CPubKey key;
-    if (!key.SetCompactSignature(hash, vchSig))
-        return false;
-    return true;
-}
-
 bool CKey::IsValid()
 {
     if (!fSet)
index 5c42c41..40e8790 100644 (file)
--- a/src/key.h
+++ b/src/key.h
@@ -201,7 +201,6 @@ public:
     }
 
     bool Verify(const uint256& hash, const std::vector<unsigned char>& vchSig) const;
-    bool VerifyCompact(const uint256 &hash, const std::vector<unsigned char>& vchSig);
 
     bool SetCompactSignature(const uint256 &hash, const std::vector<unsigned char>& vchSig);
 
index dbbafe9..1084697 100644 (file)
@@ -19,8 +19,6 @@
 #include "main.h"
 
 using namespace std;
-using namespace boost;
-
 
 
 CCriticalSection cs_setpwalletRegistered;
@@ -74,7 +72,6 @@ CScript COINBASE_FLAGS;
 const string strMessageMagic = "NovaCoin Signed Message:\n";
 
 // Settings
-int64_t nTransactionFee = MIN_TX_FEE;
 int64_t nMinimumInputValue = MIN_TXOUT_AMOUNT;
 
 // Ping and address broadcast intervals
@@ -269,34 +266,6 @@ bool CTransaction::IsFinal(int nBlockHeight, int64_t nBlockTime) const
     return true;
 }
 
-bool CTransaction::IsNewerThan(const CTransaction& old) const
-{
-    if (vin.size() != old.vin.size())
-        return false;
-    for (unsigned int i = 0; i < vin.size(); i++)
-        if (vin[i].prevout != old.vin[i].prevout)
-            return false;
-    bool fNewer = false;
-    unsigned int nLowest = numeric_limits<unsigned int>::max();
-    for (unsigned int i = 0; i < vin.size(); i++)
-    {
-        if (vin[i].nSequence != old.vin[i].nSequence)
-        {
-            if (vin[i].nSequence <= nLowest)
-            {
-                fNewer = false;
-                nLowest = vin[i].nSequence;
-            }
-            if (old.vin[i].nSequence < nLowest)
-            {
-                fNewer = true;
-                nLowest = old.vin[i].nSequence;
-            }
-        }
-    }
-    return fNewer;
-}
-
 bool CTransaction::ReadFromDisk(CDiskTxPos pos, FILE** pfileRet)
 {
     auto filein = CAutoFile(OpenBlockFile(pos.nFile, 0, pfileRet ? "rb+" : "rb"), SER_DISK, CLIENT_VERSION);
@@ -2745,18 +2714,6 @@ int64_t CBlockIndex::GetMedianTimePast() const
     return pbegin[(pend - pbegin)/2];
 }
 
-int64_t CBlockIndex::GetMedianTime() const
-{
-    const CBlockIndex* pindex = this;
-    for (int i = 0; i < nMedianTimeSpan/2; i++)
-    {
-        if (!pindex->pnext)
-            return GetBlockTime();
-        pindex = pindex->pnext;
-    }
-    return pindex->GetMedianTimePast();
-}
-
 bool CBlockIndex::IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned int nRequired, unsigned int nToCheck)
 {
     unsigned int nFound = 0;
@@ -3091,7 +3048,7 @@ int CBlockLocator::GetHeight()
 
 bool CheckDiskSpace(uint64_t nAdditionalBytes)
 {
-    uint64_t nFreeBytesAvailable = filesystem::space(GetDataDir()).available;
+    uint64_t nFreeBytesAvailable = boost::filesystem::space(GetDataDir()).available;
 
     // Check for nMinDiskSpace bytes (currently 50MB)
     if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes)
@@ -3107,7 +3064,7 @@ bool CheckDiskSpace(uint64_t nAdditionalBytes)
     return true;
 }
 
-static filesystem::path BlockFilePath(unsigned int nFile)
+static boost::filesystem::path BlockFilePath(unsigned int nFile)
 {
     string strBlockFn = strprintf("blk%04u.dat", nFile);
     return GetDataDir() / strBlockFn;
@@ -3644,7 +3601,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
         if (!pfrom->fInbound)
         {
             // Advertise our address
-            if (!fNoListen && !IsInitialBlockDownload())
+            if (fListen && !IsInitialBlockDownload())
             {
                 auto addr = GetLocalAddress(&pfrom->addr);
                 if (addr.IsRoutable())
index 1a61a63..77e1137 100644 (file)
@@ -87,7 +87,6 @@ extern uint32_t nNetworkID;
 extern std::map<uint256, CBlock*> mapOrphanBlocks;
 
 // Settings
-extern int64_t nTransactionFee;
 extern int64_t nMinimumInputValue;
 extern bool fUseFastIndex;
 extern int nScriptCheckThreads;
@@ -434,7 +433,6 @@ public:
     }
 
     bool IsFinal(int nBlockHeight=0, int64_t nBlockTime=0) const;
-    bool IsNewerThan(const CTransaction& old) const;
 
     bool IsCoinBase() const
     {
@@ -949,7 +947,6 @@ public:
     }
 
     int64_t GetMedianTimePast() const;
-    int64_t GetMedianTime() const;
 
     /**
      * Returns true if there are nRequired or more blocks of minVersion or above
index 8469f41..629fc70 100644 (file)
@@ -3,7 +3,6 @@
 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
 
 USE_LEVELDB:=0
-USE_IPV6:=1
 ARCH:=$(uname -m)
 
 # CC:=clang
@@ -37,10 +36,6 @@ LIBS += \
    -l crypto \
    -l execinfo
 
-ifneq (${USE_IPV6}, -)
-       DEFS += -DUSE_IPV6=$(USE_IPV6)
-endif
-
 LIBS+= \
  -Wl,-B$(LMODE2) \
    -l z \
@@ -130,6 +125,7 @@ OBJS= \
     obj/rpcrawtransaction.o \
     obj/script.o \
     obj/sync.o \
+    obj/timedata.o \
     obj/util.o \
     obj/wallet.o \
     obj/walletdb.o \
index 4762599..383b5a9 100644 (file)
@@ -20,7 +20,6 @@ BDB_INCLUDE_PATH:=$(DEPSDIR)/db-6.0.20.NC/build_unix
 OPENSSL_INCLUDE_PATH:=$(DEPSDIR)/openssl-1.0.2g/include
 
 USE_LEVELDB:=0
-USE_IPV6:=1
 
 INCLUDEPATHS= \
  -I"$(CURDIR)" \
@@ -56,10 +55,6 @@ DEBUGFLAGS=-g
 CFLAGS=$(xOPT_LEVEL) -msse2 -w -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
 LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -static-libgcc -static-libstdc++
 
-ifneq (${USE_IPV6}, -)
-       DEFS += -DUSE_IPV6=$(USE_IPV6)
-endif
-
 LIBS += -l mingwthrd -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l mswsock -l shlwapi
 
 # TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are
@@ -94,6 +89,7 @@ OBJS= \
     obj/rpcrawtransaction.o \
     obj/script.o \
     obj/sync.o \
+    obj/timedata.o \
     obj/util.o \
     obj/wallet.o \
     obj/walletdb.o \
index 121f8de..63decd2 100644 (file)
@@ -5,8 +5,6 @@
 USE_LEVELDB:=0
 CC=gcc
 
-
-USE_IPV6:=1
 USE_SSE2:=1
 
 BOOST_SUFFIX?=-mgw49-mt-s-1_57
@@ -46,10 +44,6 @@ DEBUGFLAGS=-g
 CFLAGS=-mthreads $(xOPT_LEVEL) -msse2 -w -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
 LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -static
 
-ifneq (${USE_IPV6}, -)
-       DEFS += -DUSE_IPV6=$(USE_IPV6)
-endif
-
 LIBS += -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l mswsock -l shlwapi
 
 # TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are
@@ -84,6 +78,7 @@ OBJS= \
     obj/rpcrawtransaction.o \
     obj/script.o \
     obj/sync.o \
+    obj/timedata.o \
     obj/util.o \
     obj/wallet.o \
     obj/walletdb.o \
index 2c5e33f..0c4c1d3 100644 (file)
@@ -21,7 +21,6 @@ LIBPATHS= \
  -L"$(DEPSDIR)/lib/db48"
 
 USE_LEVELDB:=0
-USE_IPV6:=1
 
 LIBS= -dead_strip
 
@@ -92,6 +91,7 @@ OBJS= \
     obj/rpcrawtransaction.o \
     obj/script.o \
     obj/sync.o \
+    obj/timedata.o \
     obj/util.o \
     obj/wallet.o \
     obj/walletdb.o \
@@ -104,10 +104,6 @@ OBJS= \
     obj/ipcollector.o \
     obj/serialize.o
 
-ifneq (${USE_IPV6}, -)
-       DEFS += -DUSE_IPV6=$(USE_IPV6)
-endif
-
 all: novacoind
 
 #
index 69c0d87..4aad7a3 100644 (file)
@@ -3,7 +3,6 @@
 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
 
 USE_LEVELDB:=0
-USE_IPV6:=1
 
 # CC=clang
 # CXX=clang++
@@ -36,10 +35,6 @@ LIBS += \
    -l ssl \
    -l crypto
 
-ifneq (${USE_IPV6}, -)
-       DEFS += -DUSE_IPV6=$(USE_IPV6)
-endif
-
 LIBS+= \
  -Wl,-B$(LMODE2) \
    -l z \
@@ -131,6 +126,7 @@ OBJS= \
     obj/rpcrawtransaction.o \
     obj/script.o \
     obj/sync.o \
+    obj/timedata.o \
     obj/util.o \
     obj/wallet.o \
     obj/walletdb.o \
index 7137f1d..91e4352 100644 (file)
@@ -33,19 +33,15 @@ void ThreadDNSAddressSeed2(void* parg);
 #endif
 #endif
 
-struct LocalServiceInfo {
-    int nScore;
-    uint16_t nPort;
-};
-
 //
 // Global state variables
 //
 bool fClient = false;
 bool fDiscover = true;
+bool fListen = true;
 uint64_t nLocalServices = (fClient ? 0 : NODE_NETWORK);
-static CCriticalSection cs_mapLocalHost;
-static map<CNetAddr, LocalServiceInfo> mapLocalHost;
+CCriticalSection cs_mapLocalHost;
+map<CNetAddr, LocalServiceInfo> mapLocalHost;
 static bool vfReachable[NET_MAX] = {};
 static bool vfLimited[NET_MAX] = {};
 static CNode* pnodeLocalHost = NULL;
@@ -99,7 +95,7 @@ void CNode::PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd)
 // find 'best' local address for a particular peer
 bool GetLocal(CService& addr, const CNetAddr *paddrPeer)
 {
-    if (fNoListen)
+    if (!fListen)
         return false;
 
     int nBestScore = -1;
@@ -179,7 +175,7 @@ bool RecvLine(SOCKET hSocket, string& strLine)
             {
                 // socket error
                 int nErr = WSAGetLastError();
-                printf("recv failed: %d\n", nErr);
+                printf("recv failed: %s\n", NetworkErrorString(nErr).c_str());
                 return false;
             }
         }
@@ -232,7 +228,7 @@ bool IsPeerAddrLocalGood(CNode *pnode)
 // pushes our own address to a peer
 void AdvertiseLocal(CNode *pnode)
 {
-    if (!fNoListen && pnode->fSuccessfullyConnected)
+    if (fListen && pnode->fSuccessfullyConnected)
     {
         auto addrLocal = GetLocalAddress(&pnode->addr);
         // If discovery is enabled, sometimes give our peer the address it
@@ -445,10 +441,10 @@ CNode* ConnectNode(CAddress addrConnect, const char *pszDest, int64_t nTimeout)
 #ifdef WIN32
         u_long nOne = 1;
         if (ioctlsocket(hSocket, FIONBIO, &nOne) == SOCKET_ERROR)
-            printf("ConnectSocket() : ioctlsocket non-blocking setting failed, error %d\n", WSAGetLastError());
+            printf("ConnectSocket() : ioctlsocket non-blocking setting failed, error %s\n", NetworkErrorString(WSAGetLastError()).c_str());
 #else
         if (fcntl(hSocket, F_SETFL, O_NONBLOCK) == SOCKET_ERROR)
-            printf("ConnectSocket() : fcntl non-blocking setting failed, error %d\n", errno);
+            printf("ConnectSocket() : fcntl non-blocking setting failed, error %s\n", NetworkErrorString(errno).c_str());
 #endif
 
         // Add node
@@ -724,10 +720,11 @@ CCriticalSection CNode::cs_setBanned;
 
 void CNode::ClearBanned()
 {
+    LOCK(cs_setBanned);
     setBanned.clear();
 }
 
-bool CNode::IsBanned(CNetAddr ip)
+bool CNode::IsBanned(const CNetAddr& ip)
 {
     bool fResult = false;
     {
@@ -939,7 +936,7 @@ void ThreadSocketHandler2(void* parg)
             if (have_fds)
             {
                 int nErr = WSAGetLastError();
-                printf("socket select error %d\n", nErr);
+                printf("socket select error %s\n", NetworkErrorString(nErr).c_str());
                 for (unsigned int i = 0; i <= hSocketMax; i++)
                     FD_SET(i, &fdsetRecv);
             }
@@ -955,11 +952,7 @@ void ThreadSocketHandler2(void* parg)
         for(SOCKET hListenSocket :  vhListenSocket)
         if (hListenSocket != INVALID_SOCKET && FD_ISSET(hListenSocket, &fdsetRecv))
         {
-#ifdef USE_IPV6
             struct sockaddr_storage sockaddr;
-#else
-            struct sockaddr sockaddr;
-#endif
             socklen_t len = sizeof(sockaddr);
             SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len);
             CAddress addr;
@@ -980,15 +973,12 @@ void ThreadSocketHandler2(void* parg)
             {
                 int nErr = WSAGetLastError();
                 if (nErr != WSAEWOULDBLOCK)
-                    printf("socket error accept failed: %d\n", nErr);
+                    printf("socket error accept failed: %s\n", NetworkErrorString(nErr).c_str());
             }
             else if (nInbound >= GetArgInt("-maxconnections", 125) - MAX_OUTBOUND_CONNECTIONS)
             {
-                {
-                    LOCK(cs_setservAddNodeAddresses);
-                    if (!setservAddNodeAddresses.count(addr))
-                        CloseSocket(hSocket);
-                }
+                printf("connection from %s dropped (overall limit)\n", addr.ToString().c_str());
+                CloseSocket(hSocket);
             }
             else if (CNode::IsBanned(addr))
             {
@@ -1067,7 +1057,7 @@ void ThreadSocketHandler2(void* parg)
                             if (nErr != WSAEWOULDBLOCK && nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS)
                             {
                                 if (!pnode->fDisconnect)
-                                    printf("socket recv error %d\n", nErr);
+                                    printf("socket recv error %s\n", NetworkErrorString(nErr).c_str());
                                 pnode->CloseSocketDisconnect();
                             }
                         }
@@ -1102,7 +1092,7 @@ void ThreadSocketHandler2(void* parg)
                             int nErr = WSAGetLastError();
                             if (nErr != WSAEWOULDBLOCK && nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS)
                             {
-                                printf("socket send error %d\n", nErr);
+                                printf("socket send error %s\n", NetworkErrorString(nErr).c_str());
                                 pnode->CloseSocketDisconnect();
                             }
                         }
@@ -1738,11 +1728,7 @@ bool BindListenPort(const CService &addrBind, string& strError)
     int nOne = 1;
 
     // Create socket for listening for incoming connections
-#ifdef USE_IPV6
     struct sockaddr_storage sockaddr;
-#else
-    struct sockaddr sockaddr;
-#endif
     socklen_t len = sizeof(sockaddr);
     if (!addrBind.GetSockAddr((struct sockaddr*)&sockaddr, &len))
     {
@@ -1754,7 +1740,7 @@ bool BindListenPort(const CService &addrBind, string& strError)
     SOCKET hListenSocket = socket(((struct sockaddr*)&sockaddr)->sa_family, SOCK_STREAM, IPPROTO_TCP);
     if (hListenSocket == INVALID_SOCKET)
     {
-        strError = strprintf("Error: Couldn't open socket for incoming connections (socket returned error %d)", WSAGetLastError());
+        strError = strprintf("Error: Couldn't open socket for incoming connections (socket returned error %s)", NetworkErrorString(WSAGetLastError()).c_str());
         printf("%s\n", strError.c_str());
         return false;
     }
@@ -1784,13 +1770,12 @@ bool BindListenPort(const CService &addrBind, string& strError)
     if (fcntl(hListenSocket, F_SETFL, O_NONBLOCK) == SOCKET_ERROR)
 #endif
     {
-        strError = strprintf("Error: Couldn't set properties on socket for incoming connections (error %d)", WSAGetLastError());
+        strError = strprintf("Error: Couldn't set properties on socket for incoming connections (error %s)", NetworkErrorString(WSAGetLastError()).c_str());
         printf("%s\n", strError.c_str());
         CloseSocket(hListenSocket);
         return false;
     }
 
-#ifdef USE_IPV6
     // some systems don't have IPV6_V6ONLY but are always v6only; others do have the option
     // and enable it by default or not. Try to enable it, if possible.
     if (addrBind.IsIPv6()) {
@@ -1818,7 +1803,6 @@ bool BindListenPort(const CService &addrBind, string& strError)
     }
 #endif
     }
-#endif
 
     if (::bind(hListenSocket, (struct sockaddr*)&sockaddr, len) == SOCKET_ERROR)
     {
@@ -1826,7 +1810,7 @@ bool BindListenPort(const CService &addrBind, string& strError)
         if (nErr == WSAEADDRINUSE)
             strError = strprintf(_("Unable to bind to %s on this computer. NovaCoin is probably already running."), addrBind.ToString().c_str());
         else
-            strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %d, %s)"), addrBind.ToString().c_str(), nErr, strerror(nErr));
+            strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %s)"), addrBind.ToString().c_str(), NetworkErrorString(nErr).c_str());
         printf("%s\n", strError.c_str());
         CloseSocket(hListenSocket);
         return false;
@@ -1836,7 +1820,7 @@ bool BindListenPort(const CService &addrBind, string& strError)
     // Listen for incoming connections
     if (listen(hListenSocket, SOMAXCONN) == SOCKET_ERROR)
     {
-        strError = strprintf("Error: Listening for incoming connections failed (listen returned error %d)", WSAGetLastError());
+        strError = strprintf("Error: Listening for incoming connections failed (listen returned error %s)", NetworkErrorString(WSAGetLastError()).c_str());
         printf("%s\n", strError.c_str());
         CloseSocket(hListenSocket);
         return false;
@@ -1887,7 +1871,6 @@ void static Discover()
                 if (AddLocal(addr, LOCAL_IF))
                     printf("IPv4 %s: %s\n", ifa->ifa_name, addr.ToString().c_str());
             }
-#ifdef USE_IPV6
             else if (ifa->ifa_addr->sa_family == AF_INET6)
             {
                 struct sockaddr_in6* s6 = (struct sockaddr_in6*)(ifa->ifa_addr);
@@ -1895,7 +1878,6 @@ void static Discover()
                 if (AddLocal(addr, LOCAL_IF))
                     printf("IPv6 %s: %s\n", ifa->ifa_name, addr.ToString().c_str());
             }
-#endif
         }
         freeifaddrs(myaddrs);
     }
@@ -2028,7 +2010,7 @@ public:
         for(SOCKET hListenSocket :  vhListenSocket)
             if (hListenSocket != INVALID_SOCKET)
                 if (!CloseSocket(hListenSocket))
-                    printf("CloseSocket(hListenSocket) failed with error %d\n", WSAGetLastError());
+                    printf("CloseSocket(hListenSocket) failed with error %s\n", NetworkErrorString(WSAGetLastError()).c_str());
 
         // clean up some globals (to help leak detection)
         for(CNode *pnode :  vNodes)
@@ -2111,6 +2093,7 @@ uint64_t CNode::GetTotalBytesSent()
     LOCK(cs_totalBytesSent);
     return nTotalBytesSent;
 }
+
 int64_t PoissonNextSend(int64_t nNow, int average_interval_seconds) {
     return nNow + (int64_t)(log1p(GetRand(1ULL << 48) * -0.0000000000000035527136788 /* -1/2^48 */) * average_interval_seconds * -1000000.0 + 0.5);
 }
index 0d94116..8d1667f 100644 (file)
--- a/src/net.h
+++ b/src/net.h
@@ -116,7 +116,7 @@ enum threadId
 
 extern bool fClient;
 extern bool fDiscover;
-extern bool fNoListen;
+extern bool fListen;
 
 extern bool fDiscover;
 extern uint64_t nLocalServices;
@@ -134,6 +134,13 @@ extern std::deque<std::pair<int64_t, CInv> > vRelayExpiration;
 extern CCriticalSection cs_mapRelay;
 extern std::map<CInv, int64_t> mapAlreadyAskedFor;
 
+struct LocalServiceInfo {
+    int nScore;
+    uint16_t nPort;
+};
+
+extern CCriticalSection cs_mapLocalHost;
+extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost;
 
 class CNodeStats
 {
@@ -477,7 +484,7 @@ public:
     // between nodes running old code and nodes running
     // new code.
     static void ClearBanned(); // needed for unit testing
-    static bool IsBanned(CNetAddr ip);
+    static bool IsBanned(const CNetAddr& ip);
     bool Misbehaving(int howmuch); // 1 == a little, 100 == a lot
     void copyStats(CNodeStats &stats);
     // Network stats
index 79c5b2a..7ee808a 100644 (file)
@@ -79,11 +79,7 @@ bool static LookupIntern(const char *pszName, std::vector<CNetAddr>& vIP, unsign
 
     aiHint.ai_socktype = SOCK_STREAM;
     aiHint.ai_protocol = IPPROTO_TCP;
-#ifdef USE_IPV6
     aiHint.ai_family = AF_UNSPEC;
-#else
-    aiHint.ai_family = AF_INET;
-#endif
 #ifdef WIN32
     aiHint.ai_flags = fAllowLookup ? 0 : AI_NUMERICHOST;
 #else
@@ -104,12 +100,10 @@ bool static LookupIntern(const char *pszName, std::vector<CNetAddr>& vIP, unsign
                 vIP.push_back(CNetAddr(((struct sockaddr_in*)(aiTrav->ai_addr))->sin_addr));
             break;
 
-#ifdef USE_IPV6
             case (AF_INET6):
                 assert(aiTrav->ai_addrlen >= sizeof(sockaddr_in6));
                 vIP.push_back(CNetAddr(((struct sockaddr_in6*)(aiTrav->ai_addr))->sin6_addr));
             break;
-#endif
         }
 
         aiTrav = aiTrav->ai_next;
@@ -285,11 +279,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
 {
     hSocketRet = INVALID_SOCKET;
 
-#ifdef USE_IPV6
     struct sockaddr_storage sockaddr;
-#else
-    struct sockaddr sockaddr;
-#endif
     socklen_t len = sizeof(sockaddr);
     if (!addrConnect.GetSockAddr((struct sockaddr*)&sockaddr, &len)) {
         printf("Cannot connect to %s: unsupported network\n", addrConnect.ToString().c_str());
@@ -338,7 +328,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
             }
             if (nRet == SOCKET_ERROR)
             {
-                printf("select() for connection failed: %i\n",WSAGetLastError());
+                printf("select() for connection failed: %s\n", NetworkErrorString(WSAGetLastError()).c_str());
                 CloseSocket(hSocket);
                 return false;
             }
@@ -349,13 +339,13 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
             if (getsockopt(hSocket, SOL_SOCKET, SO_ERROR, &nRet, &nRetSize) == SOCKET_ERROR)
 #endif
             {
-                printf("getsockopt() for connection failed: %i\n",WSAGetLastError());
+                printf("getsockopt() for connection failed: %s\n", NetworkErrorString(WSAGetLastError()).c_str());
                 CloseSocket(hSocket);
                 return false;
             }
             if (nRet != 0)
             {
-                printf("connect() failed after select(): %s\n",strerror(nRet));
+                printf("connect() failed after select(): %s\n", NetworkErrorString(nRet).c_str());
                 CloseSocket(hSocket);
                 return false;
             }
@@ -366,7 +356,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
         else
 #endif
         {
-            printf("connect() failed: %i\n",WSAGetLastError());
+            printf("connect() failed: %s\n", NetworkErrorString(WSAGetLastError()).c_str());
             CloseSocket(hSocket);
             return false;
         }
@@ -478,7 +468,7 @@ bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest
         return ConnectSocket(addr, hSocketRet, nTimeout);
     }
     addr = CService("0.0.0.0:0");
-    if (!HaveNameProxy)
+    if (!HaveNameProxy())
         return false;
     // first connect to name proxy server
     if (!ConnectSocketDirectly(nameProxy, hSocket, nTimeout))
@@ -538,12 +528,10 @@ CNetAddr::CNetAddr(const struct in_addr& ipv4Addr)
     memcpy(ip+12, &ipv4Addr, 4);
 }
 
-#ifdef USE_IPV6
 CNetAddr::CNetAddr(const struct in6_addr& ipv6Addr)
 {
     memcpy(ip, &ipv6Addr, 16);
 }
-#endif
 
 CNetAddr::CNetAddr(const char *pszIp, bool fAllowLookup)
 {
@@ -727,11 +715,7 @@ std::string CNetAddr::ToStringIP() const
     if (IsI2P())
         return EncodeBase32(&ip[6], 10) + ".oc.b32.i2p";
     CService serv(*this, (uint16_t)0);
-#ifdef USE_IPV6
     struct sockaddr_storage sockaddr;
-#else
-    struct sockaddr sockaddr;
-#endif
     socklen_t socklen = sizeof(sockaddr);
     if (serv.GetSockAddr((struct sockaddr*)&sockaddr, &socklen)) {
         char name[1025] = "";
@@ -776,13 +760,11 @@ bool CNetAddr::GetInAddr(struct in_addr* pipv4Addr) const
     return true;
 }
 
-#ifdef USE_IPV6
 bool CNetAddr::GetIn6Addr(struct in6_addr* pipv6Addr) const
 {
     memcpy(pipv6Addr, ip, 16);
     return true;
 }
-#endif
 
 // get canonical identifier of an address' group
 // no two connections will be attempted to addresses with the same group
@@ -963,23 +945,19 @@ CService::CService(const struct in_addr& ipv4Addr, uint16_t portIn) : CNetAddr(i
 {
 }
 
-#ifdef USE_IPV6
 CService::CService(const struct in6_addr& ipv6Addr, uint16_t portIn) : CNetAddr(ipv6Addr), port(portIn)
 {
 }
-#endif
 
 CService::CService(const struct sockaddr_in& addr) : CNetAddr(addr.sin_addr), port(ntohs(addr.sin_port))
 {
     assert(addr.sin_family == AF_INET);
 }
 
-#ifdef USE_IPV6
 CService::CService(const struct sockaddr_in6 &addr) : CNetAddr(addr.sin6_addr), port(ntohs(addr.sin6_port))
 {
    assert(addr.sin6_family == AF_INET6);
 }
-#endif
 
 bool CService::SetSockAddr(const struct sockaddr *paddr)
 {
@@ -987,11 +965,9 @@ bool CService::SetSockAddr(const struct sockaddr *paddr)
     case AF_INET:
         *this = CService(*(const struct sockaddr_in*)paddr);
         return true;
-#ifdef USE_IPV6
     case AF_INET6:
         *this = CService(*(const struct sockaddr_in6*)paddr);
         return true;
-#endif
     default:
         return false;
     }
@@ -1063,7 +1039,6 @@ bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const
         paddrin->sin_port = htons(port);
         return true;
     }
-#ifdef USE_IPV6
     if (IsIPv6()) {
         if (*addrlen < (socklen_t)sizeof(struct sockaddr_in6))
             return false;
@@ -1076,7 +1051,6 @@ bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const
         paddrin6->sin6_port = htons(port);
         return true;
     }
-#endif
     return false;
 }
 
@@ -1114,6 +1088,40 @@ void CService::SetupPort(uint16_t portIn)
     port = portIn;
 }
 
+#ifdef WIN32
+std::string NetworkErrorString(int err)
+{
+    char buf[256];
+    buf[0] = 0;
+    if(FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK,
+            NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+            buf, sizeof(buf), NULL))
+    {
+        return strprintf("%s (%d)", buf, err);
+    }
+    else
+    {
+        return strprintf("Unknown error (%d)", err);
+    }
+}
+#else
+std::string NetworkErrorString(int err)
+{
+    char buf[256];
+    const char *s = buf;
+    buf[0] = 0;
+    /* Too bad there are two incompatible implementations of the
+     * thread-safe strerror. */
+#ifdef STRERROR_R_CHAR_P /* GNU variant can return a pointer outside the passed buffer */
+    s = strerror_r(err, buf, sizeof(buf));
+#else /* POSIX variant always returns message in buffer */
+    if (strerror_r(err, buf, sizeof(buf)))
+        buf[0] = 0;
+#endif
+    return strprintf("%s (%d)", s, err);
+}
+#endif
+
 bool CloseSocket(SOCKET& hSocket)
 {
     if (hSocket == INVALID_SOCKET)
index e6f3e6d..efa59f8 100644 (file)
@@ -67,10 +67,8 @@ class CNetAddr
         std::vector<unsigned char> GetGroup() const;
         int GetReachabilityFrom(const CNetAddr *paddrPartner = NULL) const;
 
-#ifdef USE_IPV6
         CNetAddr(const struct in6_addr& pipv6Addr);
         bool GetIn6Addr(struct in6_addr* pipv6Addr) const;
-#endif
 
         friend bool operator==(const CNetAddr& a, const CNetAddr& b);
         friend bool operator!=(const CNetAddr& a, const CNetAddr& b);
@@ -110,10 +108,8 @@ class CService : public CNetAddr
         std::string ToStringPort() const;
         std::string ToStringIPPort() const;
 
-#ifdef USE_IPV6
         CService(const struct in6_addr& ipv6Addr, uint16_t port);
         CService(const struct sockaddr_in6& addr);
-#endif
 
         IMPLEMENT_SERIALIZE
             (
@@ -142,6 +138,8 @@ bool Lookup(const char *pszName, std::vector<CService>& vAddr, uint16_t portDefa
 bool LookupNumeric(const char *pszName, CService& addr, uint16_t portDefault = 0);
 bool ConnectSocket(const CService &addr, SOCKET& hSocketRet, int nTimeout = nConnectTimeout);
 bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest, uint16_t portDefault = 0, int nTimeout = nConnectTimeout);
+/** Return readable error string for a network error code */
+std::string NetworkErrorString(int err);
 /** Close socket and set hSocket to INVALID_SOCKET */
 bool CloseSocket(SOCKET& hSocket);
 
index f99ee0f..7e73504 100644 (file)
@@ -176,7 +176,8 @@ int main(int argc, char *argv[])
     ParseParameters(argc, argv);
 
     // User language is set up: pick a data directory
-    Intro::pickDataDirectory();
+    if (!Intro::pickDataDirectory())
+        return 0;
 
     // Install global event filter that makes sure that long tooltips can be word-wrapped
     app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
index 9640595..1de5eee 100644 (file)
@@ -573,6 +573,8 @@ void CoinControlDialog::updateLabels(WalletModel *model, QWidget* dialog)
 
 void CoinControlDialog::updateView()
 {
+    if (!model || !model->getOptionsModel() || !model->getAddressTableModel())
+        return;
     bool treeMode = ui->radioTreeMode->isChecked();
 
     ui->treeWidget->clear();
@@ -581,9 +583,7 @@ void CoinControlDialog::updateView()
     QFlags<Qt::ItemFlag> flgCheckbox=Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;
     QFlags<Qt::ItemFlag> flgTristate=Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate;    
 
-    int nDisplayUnit = BitcoinUnits::BTC;
-    if (model && model->getOptionsModel())
-        nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
+    int nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
 
     map<QString, vector<COutput> > mapCoins;
     model->listCoins(mapCoins);
@@ -591,11 +591,10 @@ void CoinControlDialog::updateView()
     for(auto& coins : mapCoins)
     {
         QTreeWidgetItem *itemWalletAddress = new QTreeWidgetItem();
+        itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
         QString sWalletAddress = coins.first;
-        QString sWalletLabel = "";
-        if (model->getAddressTableModel())
-            sWalletLabel = model->getAddressTableModel()->labelForAddress(sWalletAddress);
-        if (sWalletLabel.length() == 0)
+        QString sWalletLabel = model->getAddressTableModel()->labelForAddress(sWalletAddress);
+        if (sWalletLabel.isEmpty())
             sWalletLabel = tr("(no label)");
 
         if (treeMode)
@@ -665,10 +664,8 @@ void CoinControlDialog::updateView()
             }
             else if (!treeMode)
             {
-                QString sLabel = "";
-                if (model->getAddressTableModel())
-                    sLabel = model->getAddressTableModel()->labelForAddress(sAddress);
-                if (sLabel.length() == 0)
+                QString sLabel = model->getAddressTableModel()->labelForAddress(sAddress);
+                if (sLabel.isEmpty())
                     sLabel = tr("(no label)");
                 itemOutput->setText(COLUMN_LABEL, sLabel); 
             }
index f5b50f6..a52cd0a 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>740</width>
-    <height>450</height>
+    <height>514</height>
    </rect>
   </property>
   <property name="windowTitle">
        <string>&amp;Information</string>
       </attribute>
       <layout class="QGridLayout" name="gridLayout">
-       <item row="15" column="2">
-        <widget class="QLabel" name="labelConfigfile">
-         <property name="font">
-          <font>
-           <weight>75</weight>
-           <bold>true</bold>
-          </font>
+       <item row="15" column="0">
+        <widget class="QPushButton" name="openDebugLogfileButton">
+         <property name="toolTip">
+          <string>Open the NovaCoin debug log file from the current data directory. This can take a few seconds for large log files.</string>
          </property>
          <property name="text">
-          <string>Configuration file</string>
+          <string>&amp;Open</string>
+         </property>
+         <property name="autoDefault">
+          <bool>false</bool>
          </property>
         </widget>
        </item>
-       <item row="13" column="2">
-        <widget class="QLabel" name="lastBlockTime">
+       <item row="11" column="2">
+        <widget class="QLabel" name="numberOfBlocks">
          <property name="cursor">
           <cursorShape>IBeamCursor</cursorShape>
          </property>
          </property>
         </widget>
        </item>
-       <item row="11" column="0">
-        <widget class="QLabel" name="label_3">
+       <item row="16" column="0">
+        <widget class="QLabel" name="labelCLOptions">
+         <property name="font">
+          <font>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
          <property name="text">
-          <string>Current number of blocks</string>
+          <string>Command-line options</string>
          </property>
         </widget>
        </item>
-       <item row="11" column="2">
-        <widget class="QLabel" name="numberOfBlocks">
+       <item row="9" column="0">
+        <widget class="QLabel" name="label_8">
+         <property name="text">
+          <string>On testnet</string>
+         </property>
+        </widget>
+       </item>
+       <item row="8" column="2">
+        <widget class="QLabel" name="numberOfConnections">
          <property name="cursor">
           <cursorShape>IBeamCursor</cursorShape>
          </property>
          </property>
         </widget>
        </item>
-       <item row="17" column="0">
-        <widget class="QLabel" name="labelCLOptions">
+       <item row="8" column="0">
+        <widget class="QLabel" name="label_7">
+         <property name="text">
+          <string>Number of connections</string>
+         </property>
+        </widget>
+       </item>
+       <item row="10" column="0">
+        <widget class="QLabel" name="label_10">
          <property name="font">
           <font>
            <weight>75</weight>
           </font>
          </property>
          <property name="text">
-          <string>Command-line options</string>
+          <string>Block chain</string>
          </property>
         </widget>
        </item>
-       <item row="16" column="0">
-        <widget class="QPushButton" name="openDebugLogfileButton">
-         <property name="toolTip">
-          <string>Open the NovaCoin debug log file from the current data directory. This can take a few seconds for large log files.</string>
+       <item row="9" column="2">
+        <widget class="QCheckBox" name="isTestNet">
+         <property name="enabled">
+          <bool>false</bool>
          </property>
          <property name="text">
-          <string>&amp;Open</string>
-         </property>
-         <property name="autoDefault">
-          <bool>false</bool>
+          <string/>
          </property>
         </widget>
        </item>
-       <item row="15" column="0">
-        <widget class="QLabel" name="labelDebugLogfile">
-         <property name="font">
-          <font>
-           <weight>75</weight>
-           <bold>true</bold>
-          </font>
+       <item row="12" column="2">
+        <widget class="QLabel" name="lastBlockTime">
+         <property name="cursor">
+          <cursorShape>IBeamCursor</cursorShape>
          </property>
          <property name="text">
-          <string>Debug log file</string>
+          <string>N/A</string>
+         </property>
+         <property name="textFormat">
+          <enum>Qt::PlainText</enum>
+         </property>
+         <property name="textInteractionFlags">
+          <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
          </property>
         </widget>
        </item>
-       <item row="18" column="3" rowspan="2">
-        <spacer name="horizontalSpacer">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>404</width>
-           <height>20</height>
-          </size>
+       <item row="11" column="0">
+        <widget class="QLabel" name="label_3">
+         <property name="text">
+          <string>Current number of blocks</string>
          </property>
-        </spacer>
+        </widget>
        </item>
-       <item row="19" column="1">
+       <item row="18" column="1">
         <spacer name="verticalSpacer">
          <property name="orientation">
           <enum>Qt::Vertical</enum>
          </property>
         </spacer>
        </item>
-       <item row="18" column="0">
+       <item row="17" column="0">
         <widget class="QPushButton" name="showCLOptionsButton">
          <property name="toolTip">
           <string>Show the NovaCoin-Qt help message to get a list with possible NovaCoin command-line options.</string>
          </property>
         </widget>
        </item>
-       <item row="13" column="0">
+       <item row="12" column="0">
         <widget class="QLabel" name="label_2">
          <property name="text">
           <string>Last block time</string>
          </property>
         </widget>
        </item>
-       <item row="6" column="2">
-        <widget class="QLabel" name="startupTime">
+       <item row="5" column="2">
+        <widget class="QLabel" name="buildDate">
          <property name="cursor">
           <cursorShape>IBeamCursor</cursorShape>
          </property>
          </property>
         </widget>
        </item>
-       <item row="6" column="0">
-        <widget class="QLabel" name="label_13">
+       <item row="2" column="0">
+        <widget class="QLabel" name="label_6">
          <property name="text">
-          <string>Startup time</string>
+          <string>Client version</string>
          </property>
         </widget>
        </item>
-       <item row="9" column="0">
-        <widget class="QLabel" name="label_8">
+       <item row="1" column="0">
+        <widget class="QLabel" name="label_5">
          <property name="text">
-          <string>On testnet</string>
+          <string>Client name</string>
          </property>
         </widget>
        </item>
-       <item row="8" column="2">
-        <widget class="QLabel" name="numberOfConnections">
+       <item row="0" column="0">
+        <widget class="QLabel" name="label_9">
+         <property name="font">
+          <font>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="text">
+          <string>NovaCoin Core</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="2">
+        <widget class="QLabel" name="clientName">
          <property name="cursor">
           <cursorShape>IBeamCursor</cursorShape>
          </property>
          </property>
         </widget>
        </item>
-       <item row="8" column="0">
-        <widget class="QLabel" name="label_7">
+       <item row="13" column="2">
+        <spacer name="verticalSpacer_2">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="15" column="2">
+        <widget class="QPushButton" name="openConfigurationfileButton">
+         <property name="toolTip">
+          <string>Open the NovaCoin configuration file from the current data directory.</string>
+         </property>
          <property name="text">
-          <string>Number of connections</string>
+          <string>O&amp;pen</string>
+         </property>
+         <property name="autoDefault">
+          <bool>false</bool>
          </property>
         </widget>
        </item>
-       <item row="10" column="0">
-        <widget class="QLabel" name="label_10">
+       <item row="14" column="0">
+        <widget class="QLabel" name="labelDebugLogfile">
          <property name="font">
           <font>
            <weight>75</weight>
           </font>
          </property>
          <property name="text">
-          <string>Block chain</string>
+          <string>Debug log file</string>
          </property>
         </widget>
        </item>
-       <item row="9" column="2">
-        <widget class="QCheckBox" name="isTestNet">
-         <property name="enabled">
-          <bool>false</bool>
-         </property>
-         <property name="text">
-          <string/>
+       <item row="17" column="3" rowspan="2">
+        <spacer name="horizontalSpacer">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
          </property>
-        </widget>
-       </item>
-       <item row="12" column="0">
-        <widget class="QLabel" name="label_4">
-         <property name="text">
-          <string>Estimated total blocks</string>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>404</width>
+           <height>20</height>
+          </size>
          </property>
-        </widget>
+        </spacer>
        </item>
-       <item row="12" column="2">
-        <widget class="QLabel" name="totalBlocks">
+       <item row="6" column="2">
+        <widget class="QLabel" name="startupTime">
          <property name="cursor">
           <cursorShape>IBeamCursor</cursorShape>
          </property>
          </property>
         </widget>
        </item>
+       <item row="6" column="0">
+        <widget class="QLabel" name="label_13">
+         <property name="text">
+          <string>Startup time</string>
+         </property>
+        </widget>
+       </item>
+       <item row="14" column="2">
+        <widget class="QLabel" name="labelConfigfile">
+         <property name="font">
+          <font>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="text">
+          <string>Configuration file</string>
+         </property>
+        </widget>
+       </item>
        <item row="2" column="2">
         <widget class="QLabel" name="clientVersion">
          <property name="cursor">
          </property>
         </widget>
        </item>
-       <item row="5" column="2">
-        <widget class="QLabel" name="buildDate">
-         <property name="cursor">
-          <cursorShape>IBeamCursor</cursorShape>
-         </property>
-         <property name="text">
-          <string>N/A</string>
-         </property>
-         <property name="textFormat">
-          <enum>Qt::PlainText</enum>
-         </property>
-         <property name="textInteractionFlags">
-          <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="0">
-        <widget class="QLabel" name="label_6">
-         <property name="text">
-          <string>Client version</string>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="0">
-        <widget class="QLabel" name="label_9">
-         <property name="font">
-          <font>
-           <weight>75</weight>
-           <bold>true</bold>
-          </font>
-         </property>
-         <property name="text">
-          <string>NovaCoin Core</string>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="2">
-        <widget class="QLabel" name="clientName">
-         <property name="cursor">
-          <cursorShape>IBeamCursor</cursorShape>
-         </property>
-         <property name="text">
-          <string>N/A</string>
-         </property>
-         <property name="textFormat">
-          <enum>Qt::PlainText</enum>
-         </property>
-         <property name="textInteractionFlags">
-          <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="0">
-        <widget class="QLabel" name="label_5">
-         <property name="text">
-          <string>Client name</string>
-         </property>
-        </widget>
-       </item>
-       <item row="14" column="2">
-        <spacer name="verticalSpacer_2">
-         <property name="orientation">
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>20</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-       <item row="16" column="2">
-        <widget class="QPushButton" name="openConfigurationfileButton">
-         <property name="toolTip">
-          <string>Open the NovaCoin configuration file from the current data directory.</string>
-         </property>
-         <property name="text">
-          <string>O&amp;pen</string>
-         </property>
-         <property name="autoDefault">
-          <bool>false</bool>
-         </property>
-        </widget>
-       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab_console">
index 75c1c82..6da9833 100644 (file)
@@ -149,14 +149,14 @@ QString Intro::getDefaultDataDirectory()
     return GUIUtil::boostPathToQString(GetDefaultDataDir());
 }
 
-void Intro::pickDataDirectory()
+bool Intro::pickDataDirectory()
 {
     namespace fs = boost::filesystem;
     QSettings settings;
     /* If data directory provided on command line, no need to look at settings
        or show a picking dialog */
     if(!GetArg("-datadir", "").empty())
-        return;
+        return true;
     /* 1) Default data directory for operating system */
     QString dataDir = getDefaultDataDirectory();
     /* 2) Allow QSettings to override default dir */
@@ -174,7 +174,7 @@ void Intro::pickDataDirectory()
             if(!intro.exec())
             {
                 /* Cancel clicked */
-                exit(0);
+                return false;
             }
             dataDir = intro.getDataDirectory();
             try {
@@ -195,6 +195,7 @@ void Intro::pickDataDirectory()
      */
     if(dataDir != getDefaultDataDirectory())
         SoftSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting
+    return true;
 }
 
 void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable)
index c973561..dd9eb5b 100644 (file)
@@ -33,10 +33,13 @@ public:
     /**
      * Determine data directory. Let the user choose if the current one doesn't exist.
      *
+     * @returns true if a data directory was selected, false if the user cancelled the selection
+     * dialog.
+     *
      * @note do NOT call global GetDataDir() before calling this function, this
      * will cause the wrong path to be cached.
      */
-    static void pickDataDirectory();
+    static bool pickDataDirectory();
 
     /**
      * Determine default data directory for operating system.
index 7e80615..346ccb7 100644 (file)
@@ -25,10 +25,8 @@ bool static ApplyProxySettings()
 
     if (!IsLimited(NET_IPV4))
         SetProxy(NET_IPV4, addrProxy);
-#ifdef USE_IPV6
-        if (!IsLimited(NET_IPV6))
-            SetProxy(NET_IPV6, addrProxy);
-#endif
+    if (!IsLimited(NET_IPV6))
+        SetProxy(NET_IPV6, addrProxy);
 
     SetNameProxy(addrProxy);
 
index c793bf9..e9c0987 100644 (file)
@@ -13,6 +13,7 @@
 #include <QKeyEvent>
 #include <QUrl>
 #include <QScrollBar>
+#include <QStringList>
 
 #include <openssl/crypto.h>
 #include <db_cxx.h>
@@ -243,6 +244,14 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
                 return true;
             }
             break;
+        case Qt::Key_Return:
+        case Qt::Key_Enter:
+            // forward these events to lineEdit
+            if(obj == autoCompleter->popup()) {
+                QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt));
+                return true;
+            }
+            break;
         default:
             // Typing in messages widget brings focus to line edit, and redirects key there
             // Exclude most combinations and keys that emit no text, except paste shortcuts
@@ -282,6 +291,20 @@ void RPCConsole::setClientModel(ClientModel *model)
         ui->isTestNet->setChecked(model->isTestNet());
 
         setNumBlocks(model->getNumBlocks(), model->getNumBlocksOfPeers());
+
+        //Setup autocomplete and attach it
+        QStringList wordList;
+        std::vector<std::string> commandList = tableRPC.listCommands();
+        for (size_t i = 0; i < commandList.size(); ++i)
+        {
+            wordList << commandList[i].c_str();
+        }
+
+        autoCompleter = new QCompleter(wordList, this);
+        ui->lineEdit->setCompleter(autoCompleter);
+
+        // clear the lineEdit after activating from QCompleter
+        autoCompleter->popup()->installEventFilter(this);
     }
 }
 
@@ -360,11 +383,9 @@ void RPCConsole::setNumConnections(int count)
 void RPCConsole::setNumBlocks(int count, int countOfPeers)
 {
     ui->numberOfBlocks->setText(QString::number(count));
-    ui->totalBlocks->setText(QString::number(countOfPeers));
     if(clientModel)
     {
         // If there is no current number available display N/A instead of 0, which can't ever be true
-        ui->totalBlocks->setText(clientModel->getNumBlocksOfPeers() == 0 ? tr("N/A") : QString::number(clientModel->getNumBlocksOfPeers()));
         ui->lastBlockTime->setText(clientModel->getLastBlockDate().toString());
     }
 }
index aa8c8f3..d5f9b69 100644 (file)
@@ -2,6 +2,7 @@
 #define RPCCONSOLE_H
 
 #include <QWidget>
+#include <QCompleter>
 
 namespace Ui {
     class RPCConsole;
@@ -82,6 +83,7 @@ private:
     int historyPtr;
 
     void startExecutor();
+    QCompleter *autoCompleter;
 };
 
 #endif // RPCCONSOLE_H
index 35a89c4..3dd86cf 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "main.h"
 #include "wallet.h"
+#include "timedata.h"
 #include "txdb.h"
 #include "ui_interface.h"
 #include "base58.h"
index 43f8f45..b1b2638 100644 (file)
@@ -1,5 +1,6 @@
 #include "transactionrecord.h"
 
+#include "timedata.h"
 #include "wallet.h"
 #include "base58.h"
 
index bf0fda2..e1ef171 100644 (file)
@@ -3,7 +3,7 @@
 // Distributed under the MIT/X11 software license, see the accompanying
 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
 
-#include "main.h"
+#include "wallet.h"
 #include "bitcoinrpc.h"
 #include <boost/filesystem.hpp>
 #include <boost/iostreams/device/file.hpp>
index a5f9d88..3f9b46d 100644 (file)
@@ -9,6 +9,7 @@
 #include "walletdb.h"
 #include "net.h"
 #include "ntp.h"
+#include "timedata.h"
 
 using namespace json_spirit;
 using namespace std;
@@ -384,3 +385,49 @@ Value ntptime(const Array& params, bool fHelp)
 
     return obj;
 }
+
+Value getnetworkinfo(const Array& params, bool fHelp)
+{
+    if (fHelp || params.size() != 0)
+        throw runtime_error(
+            "getnetworkinfo\n"
+            "Returns an object containing various state info regarding P2P networking.\n"
+            "\nResult:\n"
+            "{\n"
+            "  \"version\": xxxxx,           (numeric) the server version\n"
+            "  \"protocolversion\": xxxxx,   (numeric) the protocol version\n"
+            "  \"timeoffset\": xxxxx,        (numeric) the time offset\n"
+            "  \"connections\": xxxxx,       (numeric) the number of connections\n"
+            "  \"proxy\": \"host:port\",     (string, optional) the proxy used by the server\n"
+            "  \"localaddresses\": [,        (array) list of local addresses\n"
+            "    \"address\": \"xxxx\",      (string) network address\n"
+            "    \"port\": xxx,              (numeric) network port\n"
+            "    \"score\": xxx              (numeric) relative score\n"
+            "  ]\n"
+            "}\n"
+        );
+
+    proxyType proxy;
+    GetProxy(NET_IPV4, proxy);
+
+    Object obj;
+    obj.push_back(Pair("version",         CLIENT_VERSION));
+    obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));
+    obj.push_back(Pair("timeoffset",      GetTimeOffset()));
+    obj.push_back(Pair("connections",     (int)vNodes.size()));
+    obj.push_back(Pair("proxy",           (proxy.IsValid() ? proxy.ToStringIPPort() : string())));
+    Array localAddresses;
+    {
+        LOCK(cs_mapLocalHost);
+        for(const auto &item : mapLocalHost)
+        {
+            Object rec;
+            rec.push_back(Pair("address", item.first.ToString()));
+            rec.push_back(Pair("port", (int)item.second.nPort));
+            rec.push_back(Pair("score", item.second.nScore));
+            localAddresses.push_back(rec);
+        }
+    }
+    obj.push_back(Pair("localaddresses", localAddresses));
+    return obj;
+}
index 8f82c97..0e9547f 100644 (file)
@@ -7,6 +7,7 @@
 #include "walletdb.h"
 #include "bitcoinrpc.h"
 #include "init.h"
+#include "timedata.h"
 #include "util.h"
 #include "ntp.h"
 #include "base58.h"
@@ -704,9 +705,8 @@ Value sendfrom(const Array& params, bool fHelp)
 
     // Parse address
     CScript scriptPubKey;
-    auto strAddress = params[0].get_str();
 
-    CBitcoinAddress address(strAddress);
+    CBitcoinAddress address(params[1].get_str());
     if (address.IsValid())
         scriptPubKey.SetAddress(address);
     else
diff --git a/src/timedata.cpp b/src/timedata.cpp
new file mode 100644 (file)
index 0000000..ae258e9
--- /dev/null
@@ -0,0 +1,107 @@
+#include "timedata.h"
+#include "netbase.h"
+#include "sync.h"
+#include "ui_interface.h"
+
+using namespace std;
+
+static CCriticalSection cs_nTimeOffset;
+static uint32_t NOVACOIN_TIMEDATA_MAX_SAMPLES = 200;
+
+// Trusted NTP offset or median of NTP samples.
+extern int64_t nNtpOffset;
+
+// Median of time samples given by other nodes.
+static int64_t nNodesOffset = numeric_limits<int64_t>::max();
+
+//
+// "Never go to sea with two chronometers; take one or three."
+// Our three time sources are:
+//  - System clock
+//  - Median of other nodes clocks
+//  - The user (asking the user to fix the system clock if the first two disagree)
+//
+
+// Select time offset:
+int64_t GetTimeOffset()
+{
+    LOCK(cs_nTimeOffset);
+    // If NTP and system clock are in agreement within 40 minutes, then use NTP.
+    if (abs(nNtpOffset) < 40 * 60)
+        return nNtpOffset;
+
+    // If not, then choose between median peer time and system clock.
+    if (abs(nNodesOffset) < 70 * 60)
+        return nNodesOffset;
+
+    return 0;
+}
+
+int64_t GetNodesOffset()
+{
+    return nNodesOffset;
+}
+
+int64_t GetAdjustedTime()
+{
+    return GetTime() + GetTimeOffset();
+}
+
+void AddTimeData(const CNetAddr& ip, int64_t nTime)
+{
+    int64_t nOffsetSample = nTime - GetTime();
+
+    LOCK(cs_nTimeOffset);
+    // Ignore duplicates
+    static set<CNetAddr> setKnown;
+    if (setKnown.size() == NOVACOIN_TIMEDATA_MAX_SAMPLES)
+        return;
+    if (!setKnown.insert(ip).second)
+        return;
+
+    // Add data
+    static CMedianFilter<int64_t> vTimeOffsets(NOVACOIN_TIMEDATA_MAX_SAMPLES,0);
+    vTimeOffsets.input(nOffsetSample);
+    printf("Added time data, samples %d, offset %+" PRId64 " (%+" PRId64 " minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
+    if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1)
+    {
+        auto nMedian = vTimeOffsets.median();
+        auto vSorted = vTimeOffsets.sorted();
+        // Only let other nodes change our time by so much
+        if (abs(nMedian) < 70 * 60)
+        {
+            nNodesOffset = nMedian;
+        }
+        else
+        {
+            nNodesOffset = numeric_limits<int64_t>::max();
+
+            static bool fDone;
+            if (!fDone)
+            {
+                bool fMatch = false;
+
+                // If nobody has a time different than ours but within 5 minutes of ours, give a warning
+                for(auto nOffset :  vSorted)
+                    if (nOffset != 0 && abs(nOffset) < 5 * 60)
+                        fMatch = true;
+
+                if (!fMatch)
+                {
+                    fDone = true;
+                    string strMessage("Warning: Please check that your computer's date and time are correct! If your clock is wrong NovaCoin will not work properly.");
+                    strMiscWarning = strMessage;
+                    printf("*** %s\n", strMessage.c_str());
+                    uiInterface.ThreadSafeMessageBox(strMessage+" ", string("NovaCoin"), CClientUIInterface::OK | CClientUIInterface::ICON_EXCLAMATION);
+                }
+            }
+        }
+        if (fDebug) {
+            for(int64_t n :  vSorted)
+                printf("%+" PRId64 "  ", n);
+            printf("|  ");
+        }
+        if (nNodesOffset != numeric_limits<int64_t>::max())
+            printf("nNodesOffset = %+" PRId64 "  (%+" PRId64 " minutes)\n", nNodesOffset, nNodesOffset/60);
+    }
+}
diff --git a/src/timedata.h b/src/timedata.h
new file mode 100644 (file)
index 0000000..a95214b
--- /dev/null
@@ -0,0 +1,76 @@
+// Copyright (c) 2014 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#ifndef NOVACOIN_TIMEDATA_H
+#define NOVACOIN_TIMEDATA_H
+
+#include <vector>
+#include <algorithm>
+#include <cassert>
+
+class CNetAddr;
+
+/** Median filter over a stream of values.
+ * Returns the median of the last N numbers
+ */
+template <typename T> class CMedianFilter
+{
+private:
+    std::vector<T> vValues;
+    std::vector<T> vSorted;
+    unsigned int nSize;
+public:
+    CMedianFilter(unsigned int size, T initial_value):
+        nSize(size)
+    {
+        vValues.reserve(size);
+        vValues.push_back(initial_value);
+        vSorted = vValues;
+    }
+
+    void input(T value)
+    {
+        if(vValues.size() == nSize)
+        {
+            vValues.erase(vValues.begin());
+        }
+        vValues.push_back(value);
+
+        vSorted.resize(vValues.size());
+        std::copy(vValues.begin(), vValues.end(), vSorted.begin());
+        std::sort(vSorted.begin(), vSorted.end());
+    }
+
+    T median() const
+    {
+        size_t size = vSorted.size();
+        assert(size>0);
+        if(size & 1) // Odd number of elements
+        {
+            return vSorted[size/2];
+        }
+        else // Even number of elements
+        {
+            return (vSorted[size/2-1] + vSorted[size/2]) / 2;
+        }
+    }
+
+    int size() const
+    {
+        return static_cast<int>(vValues.size());
+    }
+
+    std::vector<T> sorted () const
+    {
+        return vSorted;
+    }
+};
+
+// Functions to keep track of adjusted P2P time
+int64_t GetAdjustedTime();
+int64_t GetTimeOffset();
+int64_t GetNodesOffset();
+void AddTimeData(const CNetAddr& ip, int64_t nTime);
+
+#endif // NOVACOIN_TIMEDATA_H
index aad4bac..e4b5f37 100644 (file)
@@ -7,7 +7,9 @@
 #include <stdio.h>
 #include <string.h>
 #include <cassert>
-#include  <stdexcept>
+#include <stdexcept>
+
+#include <openssl/rand.h>
 
 #include "uint256.h"
 
@@ -215,3 +217,10 @@ uint256::uint256(const std::vector<unsigned char>& vch)
     else
         *this = 0;
 }
+
+uint256 GetRandHash()
+{
+    uint256 hash;
+    RAND_bytes(hash.begin(), hash.size());
+    return hash;
+}
index d6cd23f..4d60835 100644 (file)
@@ -584,4 +584,6 @@ inline const uint256 operator|(const uint256& a, const uint256& b)      { return
 inline const uint256 operator+(const uint256& a, const uint256& b)      { return (base_uint256)a +  (base_uint256)b; }
 inline const uint256 operator-(const uint256& a, const uint256& b)      { return (base_uint256)a -  (base_uint256)b; }
 
+uint256 GetRandHash();
+
 #endif
index aac1678..860de00 100644 (file)
@@ -4,6 +4,7 @@
 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
 
 #include "util.h"
+#include "allocators.h"
 #include "sync.h"
 #include "version.h"
 #include "ui_interface.h"
@@ -59,9 +60,7 @@ bool fServer = false;
 bool fCommandLine = false;
 string strMiscWarning;
 bool fTestNet = false;
-bool fNoListen = false;
 bool fLogTimestamps = false;
-CMedianFilter<int64_t> vTimeOffsets(200,0);
 bool fReopenDebugLog = false;
 
 // Extended DecodeDumpTime implementation, see this page for details:
@@ -182,13 +181,6 @@ int GetRandInt(int nMax)
     return static_cast<int>(GetRand(nMax));
 }
 
-uint256 GetRandHash()
-{
-    uint256 hash;
-    RAND_bytes(hash.begin(), hash.size());
-    return hash;
-}
-
 void FillRand(uint8_t *buffer, size_t nCount)
 {
     RAND_bytes(buffer, nCount);
@@ -1016,12 +1008,6 @@ static string FormatException(exception* pex, const char* pszThread)
             "UNKNOWN EXCEPTION       \n%s in %s       \n", pszModule, pszThread);
 }
 
-void LogException(exception* pex, const char* pszThread)
-{
-    string message = FormatException(pex, pszThread);
-    printf("\n%s", message.c_str());
-}
-
 void PrintException(exception* pex, const char* pszThread)
 {
     string message = FormatException(pex, pszThread);
@@ -1262,14 +1248,6 @@ void ShrinkDebugFile()
     }
 }
 
-//
-// "Never go to sea with two chronometers; take one or three."
-// Our three time sources are:
-//  - System clock
-//  - Median of other nodes clocks
-//  - The user (asking the user to fix the system clock if the first two disagree)
-//
-
 // System clock
 int64_t GetTime()
 {
@@ -1278,91 +1256,6 @@ int64_t GetTime()
     return now;
 }
 
-// Trusted NTP offset or median of NTP samples.
-extern int64_t nNtpOffset;
-
-// Median of time samples given by other nodes.
-static int64_t nNodesOffset = numeric_limits<int64_t>::max();
-
-// Select time offset:
-int64_t GetTimeOffset()
-{
-    // If NTP and system clock are in agreement within 40 minutes, then use NTP.
-    if (abs(nNtpOffset) < 40 * 60)
-        return nNtpOffset;
-
-    // If not, then choose between median peer time and system clock.
-    if (abs(nNodesOffset) < 70 * 60)
-        return nNodesOffset;
-
-    return 0;
-}
-
-int64_t GetNodesOffset()
-{
-        return nNodesOffset;
-}
-
-int64_t GetAdjustedTime()
-{
-    return GetTime() + GetTimeOffset();
-}
-
-void AddTimeData(const CNetAddr& ip, int64_t nTime)
-{
-    int64_t nOffsetSample = nTime - GetTime();
-
-    // Ignore duplicates
-    static set<CNetAddr> setKnown;
-    if (!setKnown.insert(ip).second)
-        return;
-
-    // Add data
-    vTimeOffsets.input(nOffsetSample);
-    printf("Added time data, samples %d, offset %+" PRId64 " (%+" PRId64 " minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
-    if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1)
-    {
-        auto nMedian = vTimeOffsets.median();
-        auto vSorted = vTimeOffsets.sorted();
-        // Only let other nodes change our time by so much
-        if (abs(nMedian) < 70 * 60)
-        {
-            nNodesOffset = nMedian;
-        }
-        else
-        {
-            nNodesOffset = numeric_limits<int64_t>::max();
-
-            static bool fDone;
-            if (!fDone)
-            {
-                bool fMatch = false;
-
-                // If nobody has a time different than ours but within 5 minutes of ours, give a warning
-                for(auto nOffset :  vSorted)
-                    if (nOffset != 0 && abs(nOffset) < 5 * 60)
-                        fMatch = true;
-
-                if (!fMatch)
-                {
-                    fDone = true;
-                    string strMessage("Warning: Please check that your computer's date and time are correct! If your clock is wrong NovaCoin will not work properly.");
-                    strMiscWarning = strMessage;
-                    printf("*** %s\n", strMessage.c_str());
-                    uiInterface.ThreadSafeMessageBox(strMessage+" ", string("NovaCoin"), CClientUIInterface::OK | CClientUIInterface::ICON_EXCLAMATION);
-                }
-            }
-        }
-        if (fDebug) {
-            for(int64_t n :  vSorted)
-                printf("%+" PRId64 "  ", n);
-            printf("|  ");
-        }
-        if (nNodesOffset != numeric_limits<int64_t>::max())
-            printf("nNodesOffset = %+" PRId64 "  (%+" PRId64 " minutes)\n", nNodesOffset, nNodesOffset/60);
-    }
-}
-
 string FormatVersion(int nVersion)
 {
     if (nVersion%100 == 0)
index 7035091..322ee7d 100644 (file)
@@ -5,9 +5,6 @@
 #ifndef BITCOIN_UTIL_H
 #define BITCOIN_UTIL_H
 
-
-#include "uint256.h"
-
 #ifndef WIN32
 #include <sys/types.h>
 #include <sys/time.h>
@@ -33,7 +30,7 @@
 #endif
 #include <inttypes.h>
 
-#include "netbase.h" // for AddTimeData
+#include "compat.h"
 
 static const int32_t nOneHour = 60 * 60;
 static const int32_t nOneDay = 24 * 60 * 60;
@@ -151,7 +148,6 @@ extern bool fServer;
 extern bool fCommandLine;
 extern std::string strMiscWarning;
 extern bool fTestNet;
-extern bool fNoListen;
 extern bool fLogTimestamps;
 extern bool fReopenDebugLog;
 
@@ -185,7 +181,6 @@ bool ATTR_WARN_PRINTF(1,2) error(const char *format, ...);
  */
 #define printf OutputDebugStringF
 
-void LogException(std::exception* pex, const char* pszThread);
 void PrintException(std::exception* pex, const char* pszThread);
 void PrintExceptionContinue(std::exception* pex, const char* pszThread);
 void ParseString(const std::string& str, char c, std::vector<std::string>& v);
@@ -227,18 +222,13 @@ boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
 void ShrinkDebugFile();
 int GetRandInt(int nMax);
 uint64_t GetRand(uint64_t nMax);
-uint256 GetRandHash();
 void FillRand(uint8_t *buffer, size_t nCount);
 int64_t GetTime();
 int64_t GetTimeMillis();
 int64_t GetTimeMicros();
 
-int64_t GetAdjustedTime();
-int64_t GetTimeOffset();
-int64_t GetNodesOffset();
 std::string FormatFullVersion();
 std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments);
-void AddTimeData(const CNetAddr& ip, int64_t nTime);
 void runCommand(std::string strCommand);
 
 
@@ -466,62 +456,6 @@ bool TimingResistantEqual(const T& a, const T& b)
     return accumulator == 0;
 }
 
-/** Median filter over a stream of values.
- * Returns the median of the last N numbers
- */
-template <typename T> class CMedianFilter
-{
-private:
-    std::vector<T> vValues;
-    std::vector<T> vSorted;
-    unsigned int nSize;
-public:
-    CMedianFilter(unsigned int size, T initial_value):
-        nSize(size)
-    {
-        vValues.reserve(size);
-        vValues.push_back(initial_value);
-        vSorted = vValues;
-    }
-
-    void input(T value)
-    {
-        if(vValues.size() == nSize)
-        {
-            vValues.erase(vValues.begin());
-        }
-        vValues.push_back(value);
-
-        vSorted.resize(vValues.size());
-        std::copy(vValues.begin(), vValues.end(), vSorted.begin());
-        std::sort(vSorted.begin(), vSorted.end());
-    }
-
-    T median() const
-    {
-        size_t size = vSorted.size();
-        assert(size>0);
-        if(size & 1) // Odd number of elements
-        {
-            return vSorted[size/2];
-        }
-        else // Even number of elements
-        {
-            return (vSorted[size/2-1] + vSorted[size/2]) / 2;
-        }
-    }
-
-    int size() const
-    {
-        return static_cast<int>(vValues.size());
-    }
-
-    std::vector<T> sorted () const
-    {
-        return vSorted;
-    }
-};
-
 bool NewThread(void(*pfn)(void*), void* parg);
 
 #ifdef WIN32
index 8430dc7..2499a40 100644 (file)
@@ -25,14 +25,14 @@ const std::string CLIENT_NAME("Satoshi");
 //code specific to MSVC compiler
 #define CL_NAME   "-msvc"
 #elif __clang__
-//code specific to clang compilers
+//code specific to clang compiler
 #define CL_NAME   "-clang"
-#elif __GNUC__
-//code for GNU C compiler
-#define CL_NAME   "-gcc"
 #elif __MINGW32__
-//code specific to mingw compilers
+//code specific to mingw compiler
 #define CL_NAME   "-mingw"
+#elif __GNUC__
+//code specific to gnu compiler
+#define CL_NAME   "-gcc"
 #else
 #define CL_NAME   "-genericcl"
 //others
@@ -57,11 +57,10 @@ const std::string CLIENT_NAME("Satoshi");
 #    include "build.h"
 #endif
 
-// git will put "#define GIT_ARCHIVE 1" on the next line inside archives. 
-#define GIT_ARCHIVE 1
+// git will put "#define GIT_ARCHIVE 1" on the next line inside archives.
 #ifdef GIT_ARCHIVE
-#    define GIT_COMMIT_ID "32a928e"
-#    define GIT_COMMIT_DATE "$Format:%cD"
+#define GIT_COMMIT_ID "$Format:%h$"
+#define GIT_COMMIT_DATE "$Format:%cD$"
 #endif
 
 #define BUILD_DESC_FROM_COMMIT(maj,min,rev,commit) \
index c90b374..8a406fd 100644 (file)
 #include "base58.h"
 #include "kernel.h"
 #include "coincontrol.h"
+#include "timedata.h"
+
 #include <openssl/bio.h>
 
 #include "main.h"
 
 using namespace std;
+
+//Settings
+
 extern int64_t nReserveBalance;
+int64_t nTransactionFee = MIN_TX_FEE;
 
 //////////////////////////////////////////////////////////////////////////////
 //
@@ -2865,21 +2871,6 @@ void CWallet::ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool)
     }
 }
 
-int64_t CWallet::AddReserveKey(const CKeyPool& keypool)
-{
-    {
-        LOCK2(cs_main, cs_wallet);
-        CWalletDB walletdb(strWalletFile);
-
-        int64_t nIndex = 1 + *(--setKeyPool.end());
-        if (!walletdb.WritePool(nIndex, keypool))
-            throw runtime_error("AddReserveKey() : writing added key failed");
-        setKeyPool.insert(nIndex);
-        return nIndex;
-    }
-    return -1;
-}
-
 void CWallet::KeepKey(int64_t nIndex)
 {
     // Remove from key pool
index 8298f78..fbcd5c1 100644 (file)
@@ -7,8 +7,7 @@
 
 #include <string>
 #include <vector>
-
-#include <stdlib.h>
+#include <cstdlib>
 
 #include "main.h"
 #include "key.h"
 
 extern bool fWalletUnlockMintOnly;
 extern bool fConfChange;
+
 class CAccountingEntry;
 class CWalletTx;
 class CReserveKey;
 class COutput;
 class CCoinControl;
 
+//Settings
+extern int64_t nTransactionFee;
+
 // Set of selected transactions
 typedef std::set<std::pair<const CWalletTx*,unsigned int> > CoinsSet;
 
@@ -216,7 +219,6 @@ public:
 
     bool NewKeyPool(unsigned int nSize = 0);
     bool TopUpKeyPool(unsigned int nSize = 0);
-    int64_t AddReserveKey(const CKeyPool& keypool);
     void ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool);
     void KeepKey(int64_t nIndex);
     void ReturnKey(int64_t nIndex);