Rollup to svost current state.
<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" />
<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>
</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>
<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>
<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>
<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>
<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>
USE_LEVELDB:=0
на
USE_LEVELDB:=1
-(выше USE_IPV6:=1)
+
Так же измените
cd leveldb; make; cd ..
на
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
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
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
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
USE_LEVELDB:=0
на
USE_LEVELDB:=1
-(выше USE_IPV6:=1)
+
Откройте файл /home/<ваше имя>/novacoin/src/leveldb/Makefile
Вставьте ниже строчки CXXFLAGS += -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT) следующие строки:
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 количество ядер вашего процессора, которые вы хотите выделить под сборку)
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
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 \
src/uint256.cpp \
src/ecies.cpp \
src/ipcollector.cpp \
- src/serialize.cpp
+ src/serialize.cpp \
+ src/timedata.cpp
RESOURCES += \
#include "netbase.h"
#include "protocol.h"
+#include "timedata.h"
#include "util.h"
#include "sync.h"
#include "key.h"
#include "net.h"
#include "sync.h"
+#include "timedata.h"
#include "ui_interface.h"
using namespace std;
#include <set>
#include <string>
+#include "serialize.h"
#include "uint256.h"
#include "util.h"
CMalleablePubKey mPubKey;
mPubKey.setvch(vchData);
keyID = mPubKey.GetID();
+ return true;
}
default: return false;
}
#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
#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>
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 },
{ "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 },
boost::ref(context),
fUseSSL,
conn,
- boost::asio::placeholders::error));
+ _1));
}
/**
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
}
}
+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)
{
* @throws an exception (json_spirit::Value) when an error happens.
*/
json_spirit::Value execute(const std::string &method, const json_spirit::Array ¶ms) const;
+ /**
+ * Returns a list of registered commands
+ * @returns List of registered commands.
+ */
+ std::vector<std::string> listCommands() const;
};
extern const CRPCTable tableRPC;
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);
// 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
// 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;
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;
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;
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;
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;
using namespace std;
-using namespace boost;
CWallet* pwalletMain;
CClientUIInterface uiInterface;
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;
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)
SetLimited(net);
}
}
-#if defined(USE_IPV6)
-#if ! USE_IPV6
- else
- SetLimited(NET_IPV6);
-#endif
-#endif
CService addrProxy;
bool fProxy = false;
if (!IsLimited(NET_IPV4))
SetProxy(NET_IPV4, addrProxy);
-#ifdef USE_IPV6
if (!IsLimited(NET_IPV6))
SetProxy(NET_IPV6, addrProxy);
-#endif
SetNameProxy(addrProxy);
fProxy = true;
}
// 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"]) {
} 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);
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);
}
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);
}
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.
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));
{
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);
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)
}
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);
#include "main.h"
using namespace std;
-using namespace boost;
-
CCriticalSection cs_setpwalletRegistered;
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
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);
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;
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)
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;
if (!pfrom->fInbound)
{
// Advertise our address
- if (!fNoListen && !IsInitialBlockDownload())
+ if (fListen && !IsInitialBlockDownload())
{
auto addr = GetLocalAddress(&pfrom->addr);
if (addr.IsRoutable())
extern std::map<uint256, CBlock*> mapOrphanBlocks;
// Settings
-extern int64_t nTransactionFee;
extern int64_t nMinimumInputValue;
extern bool fUseFastIndex;
extern int nScriptCheckThreads;
}
bool IsFinal(int nBlockHeight=0, int64_t nBlockTime=0) const;
- bool IsNewerThan(const CTransaction& old) const;
bool IsCoinBase() const
{
}
int64_t GetMedianTimePast() const;
- int64_t GetMedianTime() const;
/**
* Returns true if there are nRequired or more blocks of minVersion or above
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
USE_LEVELDB:=0
-USE_IPV6:=1
ARCH:=$(uname -m)
# CC:=clang
-l crypto \
-l execinfo
-ifneq (${USE_IPV6}, -)
- DEFS += -DUSE_IPV6=$(USE_IPV6)
-endif
-
LIBS+= \
-Wl,-B$(LMODE2) \
-l z \
obj/rpcrawtransaction.o \
obj/script.o \
obj/sync.o \
+ obj/timedata.o \
obj/util.o \
obj/wallet.o \
obj/walletdb.o \
OPENSSL_INCLUDE_PATH:=$(DEPSDIR)/openssl-1.0.2g/include
USE_LEVELDB:=0
-USE_IPV6:=1
INCLUDEPATHS= \
-I"$(CURDIR)" \
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
obj/rpcrawtransaction.o \
obj/script.o \
obj/sync.o \
+ obj/timedata.o \
obj/util.o \
obj/wallet.o \
obj/walletdb.o \
USE_LEVELDB:=0
CC=gcc
-
-USE_IPV6:=1
USE_SSE2:=1
BOOST_SUFFIX?=-mgw49-mt-s-1_57
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
obj/rpcrawtransaction.o \
obj/script.o \
obj/sync.o \
+ obj/timedata.o \
obj/util.o \
obj/wallet.o \
obj/walletdb.o \
-L"$(DEPSDIR)/lib/db48"
USE_LEVELDB:=0
-USE_IPV6:=1
LIBS= -dead_strip
obj/rpcrawtransaction.o \
obj/script.o \
obj/sync.o \
+ obj/timedata.o \
obj/util.o \
obj/wallet.o \
obj/walletdb.o \
obj/ipcollector.o \
obj/serialize.o
-ifneq (${USE_IPV6}, -)
- DEFS += -DUSE_IPV6=$(USE_IPV6)
-endif
-
all: novacoind
#
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
USE_LEVELDB:=0
-USE_IPV6:=1
# CC=clang
# CXX=clang++
-l ssl \
-l crypto
-ifneq (${USE_IPV6}, -)
- DEFS += -DUSE_IPV6=$(USE_IPV6)
-endif
-
LIBS+= \
-Wl,-B$(LMODE2) \
-l z \
obj/rpcrawtransaction.o \
obj/script.o \
obj/sync.o \
+ obj/timedata.o \
obj/util.o \
obj/wallet.o \
obj/walletdb.o \
#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;
// find 'best' local address for a particular peer
bool GetLocal(CService& addr, const CNetAddr *paddrPeer)
{
- if (fNoListen)
+ if (!fListen)
return false;
int nBestScore = -1;
{
// socket error
int nErr = WSAGetLastError();
- printf("recv failed: %d\n", nErr);
+ printf("recv failed: %s\n", NetworkErrorString(nErr).c_str());
return false;
}
}
// 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
#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
void CNode::ClearBanned()
{
+ LOCK(cs_setBanned);
setBanned.clear();
}
-bool CNode::IsBanned(CNetAddr ip)
+bool CNode::IsBanned(const CNetAddr& ip)
{
bool fResult = false;
{
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);
}
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;
{
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))
{
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();
}
}
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();
}
}
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))
{
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;
}
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()) {
}
#endif
}
-#endif
if (::bind(hListenSocket, (struct sockaddr*)&sockaddr, len) == SOCKET_ERROR)
{
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;
// 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;
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);
if (AddLocal(addr, LOCAL_IF))
printf("IPv6 %s: %s\n", ifa->ifa_name, addr.ToString().c_str());
}
-#endif
}
freeifaddrs(myaddrs);
}
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)
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);
}
extern bool fClient;
extern bool fDiscover;
-extern bool fNoListen;
+extern bool fListen;
extern bool fDiscover;
extern uint64_t nLocalServices;
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
{
// 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
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
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;
{
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());
}
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;
}
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;
}
else
#endif
{
- printf("connect() failed: %i\n",WSAGetLastError());
+ printf("connect() failed: %s\n", NetworkErrorString(WSAGetLastError()).c_str());
CloseSocket(hSocket);
return false;
}
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))
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)
{
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] = "";
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
{
}
-#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)
{
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;
}
paddrin->sin_port = htons(port);
return true;
}
-#ifdef USE_IPV6
if (IsIPv6()) {
if (*addrlen < (socklen_t)sizeof(struct sockaddr_in6))
return false;
paddrin6->sin6_port = htons(port);
return true;
}
-#endif
return false;
}
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)
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);
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
(
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);
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));
void CoinControlDialog::updateView()
{
+ if (!model || !model->getOptionsModel() || !model->getAddressTableModel())
+ return;
bool treeMode = ui->radioTreeMode->isChecked();
ui->treeWidget->clear();
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);
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)
}
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);
}
<x>0</x>
<y>0</y>
<width>740</width>
- <height>450</height>
+ <height>514</height>
</rect>
</property>
<property name="windowTitle">
<string>&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>&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>&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&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&pen</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- </item>
</layout>
</widget>
<widget class="QWidget" name="tab_console">
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 */
if(!intro.exec())
{
/* Cancel clicked */
- exit(0);
+ return false;
}
dataDir = intro.getDataDirectory();
try {
*/
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)
/**
* 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.
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);
#include <QKeyEvent>
#include <QUrl>
#include <QScrollBar>
+#include <QStringList>
#include <openssl/crypto.h>
#include <db_cxx.h>
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
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);
}
}
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());
}
}
#define RPCCONSOLE_H
#include <QWidget>
+#include <QCompleter>
namespace Ui {
class RPCConsole;
int historyPtr;
void startExecutor();
+ QCompleter *autoCompleter;
};
#endif // RPCCONSOLE_H
#include "main.h"
#include "wallet.h"
+#include "timedata.h"
#include "txdb.h"
#include "ui_interface.h"
#include "base58.h"
#include "transactionrecord.h"
+#include "timedata.h"
#include "wallet.h"
#include "base58.h"
// 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>
#include "walletdb.h"
#include "net.h"
#include "ntp.h"
+#include "timedata.h"
using namespace json_spirit;
using namespace std;
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;
+}
#include "walletdb.h"
#include "bitcoinrpc.h"
#include "init.h"
+#include "timedata.h"
#include "util.h"
#include "ntp.h"
#include "base58.h"
// 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
--- /dev/null
+#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);
+ }
+}
--- /dev/null
+// 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
#include <stdio.h>
#include <string.h>
#include <cassert>
-#include <stdexcept>
+#include <stdexcept>
+
+#include <openssl/rand.h>
#include "uint256.h"
else
*this = 0;
}
+
+uint256 GetRandHash()
+{
+ uint256 hash;
+ RAND_bytes(hash.begin(), hash.size());
+ return hash;
+}
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
// 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"
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:
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);
"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);
}
}
-//
-// "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()
{
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)
#ifndef BITCOIN_UTIL_H
#define BITCOIN_UTIL_H
-
-#include "uint256.h"
-
#ifndef WIN32
#include <sys/types.h>
#include <sys/time.h>
#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;
extern bool fCommandLine;
extern std::string strMiscWarning;
extern bool fTestNet;
-extern bool fNoListen;
extern bool fLogTimestamps;
extern bool fReopenDebugLog;
*/
#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);
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);
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
//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
# 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) \
#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;
//////////////////////////////////////////////////////////////////////////////
//
}
}
-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
#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;
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);