mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "windatabase.h"
|
||||
#include "dbutility.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
Database* Database::newMysqlDatabase(const char* host,const char* user,const char* pass)
|
||||
{
|
||||
return(new WinDatabase(host,user,pass));
|
||||
@@ -71,7 +73,7 @@ int WinDatabase::getNumRowsAffected()
|
||||
}
|
||||
|
||||
// returns true if the query went ok
|
||||
bool WinDatabase::executeSQL(const char* sql)
|
||||
bool WinDatabase::executeSQL(const char* sql, bool fail_okay)
|
||||
{
|
||||
SQLRETURN rc = SQLExecDirect(hstmt,(unsigned char*) sql,SQL_NTS);
|
||||
if(rc==SQL_ERROR)
|
||||
@@ -120,8 +122,7 @@ bool WinDatabase::startIterRows()
|
||||
|
||||
if(mNumCol)
|
||||
{
|
||||
delete[](mColNameTable);
|
||||
mColNameTable=new i4_str[mNumCol];
|
||||
mColNameTable.resize(mNumCol);
|
||||
|
||||
// fill out the column name table
|
||||
for(int n = 1; n <= mNumCol; n++)
|
||||
@@ -149,14 +150,14 @@ bool WinDatabase::getNextRow()
|
||||
char* WinDatabase::getStr(int colIndex,string& retStr)
|
||||
{
|
||||
colIndex++;
|
||||
(*retStr)="";
|
||||
retStr="";
|
||||
char buf[1000];
|
||||
// SQLINTEGER len;
|
||||
buf[0]=0;
|
||||
|
||||
while(SQLGetData(hstmt, colIndex, SQL_C_CHAR, &buf, 1000,NULL)!= SQL_NO_DATA)
|
||||
{
|
||||
(*retStr) += buf;
|
||||
retStr += buf;
|
||||
// theUI->statusMsg("Win: %s",buf);
|
||||
}
|
||||
|
||||
@@ -166,7 +167,7 @@ char* WinDatabase::getStr(int colIndex,string& retStr)
|
||||
|
||||
//theUI->statusMsg("Win: %s",buf);
|
||||
|
||||
return(*retStr);
|
||||
return((char*)retStr.c_str());
|
||||
}
|
||||
|
||||
int32 WinDatabase::getInt(int colIndex)
|
||||
@@ -210,3 +211,29 @@ void WinDatabase::endIterRows()
|
||||
rc = SQLFreeStmt(hstmt, SQL_CLOSE);
|
||||
mystmt(hstmt,rc);
|
||||
}
|
||||
|
||||
// TODO
|
||||
void WinDatabase::escape(const unsigned char* start,int size,std::string& retStr)
|
||||
{
|
||||
retStr=(char*)start;
|
||||
}
|
||||
|
||||
// TODO
|
||||
int WinDatabase::getLastInsertID()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
uint64 WinDatabase::getBigInt(int colIndex)
|
||||
{
|
||||
colIndex++;
|
||||
uint64 ret=0;
|
||||
SQLRETURN rc = SQLGetData(hstmt,colIndex,SQL_INTEGER,&ret,sizeof(uint64),NULL);
|
||||
mystmt(hstmt,rc);
|
||||
return(ret);
|
||||
}
|
||||
// TODO:
|
||||
int WinDatabase::getBinary(int colIndex,unsigned char* buf,int maxSize)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
//char* getPass(){ return((char*)mDBPass.c_str()); }
|
||||
|
||||
// returns true if the query went ok
|
||||
bool executeSQL(const char* sql);
|
||||
bool executeSQL(const char* sql, bool fail_okay=false);
|
||||
|
||||
int getNumRowsAffected();
|
||||
int getLastInsertID();
|
||||
@@ -49,9 +49,10 @@ public:
|
||||
float getFloat(int colIndex);
|
||||
bool getBool(int colIndex);
|
||||
uint64 getBigInt(int colIndex);
|
||||
bool getBinary(int colIndex,unsigned char* buf,int maxSize);
|
||||
int getBinary(int colIndex,unsigned char* buf,int maxSize);
|
||||
bool getNull(int colIndex){ return(true); }
|
||||
|
||||
void escape(unsigned char* start,int size,std::string& retStr);
|
||||
void escape(const unsigned char* start,int size,std::string& retStr);
|
||||
};
|
||||
|
||||
|
||||
|
||||
125
newcoin.vcxproj
125
newcoin.vcxproj
@@ -19,13 +19,13 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
@@ -48,14 +48,14 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>BOOST_TEST_NO_MAIN;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\OpenSSL\include;..\boost_1_47_0;..\protobuf-2.4.1\src\</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>..\OpenSSL\lib\VC;..\boost_1_47_0\stage\lib;..\protobuf-2.4.1\vsprojects\Debug</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libeay32MTd.lib;libprotobuf.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ssleay32MDd.lib;libeay32MTd.lib;libprotobuf.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
@@ -72,62 +72,84 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>C:\code\boost_1_47_0;C:\code\protobuf-2.4.1\src\google</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>BOOST_TEST_NO_MAIN;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\OpenSSL\include;..\boost_1_47_0;..\protobuf-2.4.1\src</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>C:\code\OpenSSL\lib\VC;C:\code\boost_1_47_0\stage\lib;</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>..\OpenSSL\lib\VC;..\boost_1_47_0\stage\lib;..\protobuf-2.4.1\vsprojects\Release</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libprotobuf.lib;ssleay32MD.lib;libeay32MD.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AccountState.cpp" />
|
||||
<ClCompile Include="Application.cpp" />
|
||||
<ClCompile Include="BitcoinUtil.cpp" />
|
||||
<ClCompile Include="CallRPC.cpp" />
|
||||
<ClCompile Include="Config.cpp" />
|
||||
<ClCompile Include="ConnectionPool.cpp" />
|
||||
<ClCompile Include="Conversion.cpp" />
|
||||
<ClCompile Include="cryptopp\cpu.cpp" />
|
||||
<ClCompile Include="cryptopp\sha.cpp" />
|
||||
<ClCompile Include="database\database.cpp" />
|
||||
<ClCompile Include="database\sqlite3.c" />
|
||||
<ClCompile Include="database\SqliteDatabase.cpp" />
|
||||
<ClCompile Include="DBInit.cpp" />
|
||||
<ClCompile Include="DeterministicKeys.cpp" />
|
||||
<ClCompile Include="HashedObject.cpp" />
|
||||
<ClCompile Include="database\win\windatabase.cpp" />
|
||||
<ClCompile Include="json\json_reader.cpp" />
|
||||
<ClCompile Include="json\json_value.cpp" />
|
||||
<ClCompile Include="json\json_writer.cpp" />
|
||||
<ClCompile Include="KnownNodeList.cpp" />
|
||||
<ClCompile Include="Ledger.cpp" />
|
||||
<ClCompile Include="LedgerHistory.cpp" />
|
||||
<ClCompile Include="LedgerMaster.cpp" />
|
||||
<ClCompile Include="LocalTransaction.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="NetworkOPs.cpp" />
|
||||
<ClCompile Include="newcoin.pb.cc" />
|
||||
<ClCompile Include="NewcoinAddress.cpp" />
|
||||
<ClCompile Include="PackedMessage.cpp" />
|
||||
<ClCompile Include="PeerDoor.cpp" />
|
||||
<ClCompile Include="Peer.cpp" />
|
||||
<ClCompile Include="PubKeyCache.cpp" />
|
||||
<ClCompile Include="RequestParser.cpp" />
|
||||
<ClCompile Include="rpc.cpp" />
|
||||
<ClCompile Include="RPCServer.cpp" />
|
||||
<ClCompile Include="RPCDoor.cpp" />
|
||||
<ClCompile Include="Serializer.cpp" />
|
||||
<ClCompile Include="SHAMap.cpp" />
|
||||
<ClCompile Include="SHAMapDiff.cpp" />
|
||||
<ClCompile Include="SHAMapNodes.cpp" />
|
||||
<ClCompile Include="TimingService.cpp" />
|
||||
<ClCompile Include="Transaction.cpp" />
|
||||
<ClCompile Include="UniqueNodeList.cpp" />
|
||||
<ClCompile Include="util\pugixml.cpp" />
|
||||
<ClCompile Include="Wallet.cpp" />
|
||||
<ClCompile Include="obj\src\newcoin.pb.cc" />
|
||||
<ClCompile Include="src\AccountState.cpp" />
|
||||
<ClCompile Include="src\Amount.cpp" />
|
||||
<ClCompile Include="src\Application.cpp" />
|
||||
<ClCompile Include="src\BitcoinUtil.cpp" />
|
||||
<ClCompile Include="src\CallRPC.cpp" />
|
||||
<ClCompile Include="src\Config.cpp" />
|
||||
<ClCompile Include="src\ConnectionPool.cpp" />
|
||||
<ClCompile Include="src\Conversion.cpp" />
|
||||
<ClCompile Include="src\Currency.cpp" />
|
||||
<ClCompile Include="src\DBInit.cpp" />
|
||||
<ClCompile Include="src\DeterministicKeys.cpp" />
|
||||
<ClCompile Include="src\ECIES.cpp" />
|
||||
<ClCompile Include="src\Hanko.cpp" />
|
||||
<ClCompile Include="src\HashedObject.cpp" />
|
||||
<ClCompile Include="src\HttpsClient.cpp" />
|
||||
<ClCompile Include="src\Ledger.cpp" />
|
||||
<ClCompile Include="src\LedgerAcquire.cpp" />
|
||||
<ClCompile Include="src\LedgerFormats.cpp" />
|
||||
<ClCompile Include="src\LedgerHistory.cpp" />
|
||||
<ClCompile Include="src\LedgerIndex.cpp" />
|
||||
<ClCompile Include="src\LedgerMaster.cpp" />
|
||||
<ClCompile Include="src\LedgerNode.cpp" />
|
||||
<ClCompile Include="src\LocalTransaction.cpp" />
|
||||
<ClCompile Include="src\main.cpp" />
|
||||
<ClCompile Include="src\NetworkOPs.cpp" />
|
||||
<ClCompile Include="src\NewcoinAddress.cpp" />
|
||||
<ClCompile Include="src\PackedMessage.cpp" />
|
||||
<ClCompile Include="src\ParseSection.cpp" />
|
||||
<ClCompile Include="src\Peer.cpp" />
|
||||
<ClCompile Include="src\PeerDoor.cpp" />
|
||||
<ClCompile Include="src\PlatRand.cpp" />
|
||||
<ClCompile Include="src\PubKeyCache.cpp" />
|
||||
<ClCompile Include="src\RequestParser.cpp" />
|
||||
<ClCompile Include="src\rfc1751.cpp" />
|
||||
<ClCompile Include="src\rpc.cpp" />
|
||||
<ClCompile Include="src\RPCCommands.cpp" />
|
||||
<ClCompile Include="src\RPCDoor.cpp" />
|
||||
<ClCompile Include="src\RPCServer.cpp" />
|
||||
<ClCompile Include="src\SerializedLedger.cpp" />
|
||||
<ClCompile Include="src\SerializedObject.cpp" />
|
||||
<ClCompile Include="src\SerializedTransaction.cpp" />
|
||||
<ClCompile Include="src\SerializedTypes.cpp" />
|
||||
<ClCompile Include="src\SerializedValidation.cpp" />
|
||||
<ClCompile Include="src\Serializer.cpp" />
|
||||
<ClCompile Include="src\SHAMap.cpp" />
|
||||
<ClCompile Include="src\SHAMapDiff.cpp" />
|
||||
<ClCompile Include="src\SHAMapNodes.cpp" />
|
||||
<ClCompile Include="src\SHAMapSync.cpp" />
|
||||
<ClCompile Include="src\Transaction.cpp" />
|
||||
<ClCompile Include="src\TransactionEngine.cpp" />
|
||||
<ClCompile Include="src\TransactionFormats.cpp" />
|
||||
<ClCompile Include="src\TransactionMaster.cpp" />
|
||||
<ClCompile Include="src\UniqueNodeList.cpp" />
|
||||
<ClCompile Include="src\utils.cpp" />
|
||||
<ClCompile Include="src\Wallet.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Account.h" />
|
||||
@@ -161,8 +183,8 @@
|
||||
<ClInclude Include="Ledger.h" />
|
||||
<ClInclude Include="LedgerHistory.h" />
|
||||
<ClInclude Include="LedgerMaster.h" />
|
||||
<ClInclude Include="newcoin.pb.h" />
|
||||
<ClInclude Include="NewcoinAddress.h" />
|
||||
<ClInclude Include="obj\src\newcoin.pb.h" />
|
||||
<ClInclude Include="PackedMessage.h" />
|
||||
<ClInclude Include="PeerDoor.h" />
|
||||
<ClInclude Include="NetworkThread.h" />
|
||||
@@ -189,11 +211,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="config.xml" />
|
||||
<CustomBuild Include="newcoin.proto">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\protoc-2.4.1-win32\protoc -I=..\newcoin --cpp_out=..\newcoin ..\newcoin\newcoin.proto</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">newcoin.pb.h</Outputs>
|
||||
</CustomBuild>
|
||||
<None Include="db layout.txt" />
|
||||
<None Include="html\newcoin.html">
|
||||
<SubType>Designer</SubType>
|
||||
@@ -201,7 +218,15 @@
|
||||
<None Include="Makefile" />
|
||||
<None Include="nodes.xml" />
|
||||
<None Include="notes.txt" />
|
||||
<None Include="tests\client2\config.xml" />
|
||||
<CustomBuild Include="src\newcoin.proto">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\protoc-2.4.1-win32\protoc -I=..\newcoin\src --cpp_out=..\newcoin\obj\src ..\newcoin\src\newcoin.proto</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">obj\src\newcoin.pb.h</Outputs>
|
||||
</CustomBuild>
|
||||
<None Include="SConstruct" />
|
||||
<None Include="tests\client2\config.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="todo.txt" />
|
||||
<None Include="unl.xml" />
|
||||
<None Include="wallet.xml" />
|
||||
|
||||
@@ -37,110 +37,20 @@
|
||||
<Filter Include="tests\client2">
|
||||
<UniqueIdentifier>{b27b04b8-1c6e-4b20-9364-f18d4682dc00}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\database">
|
||||
<UniqueIdentifier>{60c3631e-8855-4a61-bdd3-9892d96242d5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Application.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ConnectionPool.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Peer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Config.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KnownNodeList.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="util\pugixml.cpp">
|
||||
<Filter>Header Files\util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LedgerHistory.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Ledger.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Wallet.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UniqueNodeList.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PeerDoor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RPCDoor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="newcoin.pb.cc">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PackedMessage.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rpc.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BitcoinUtil.cpp">
|
||||
<Filter>Header Files\util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RequestParser.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RPCServer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TimingService.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LedgerMaster.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="NewcoinAddress.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cryptopp\cpu.cpp">
|
||||
<Filter>Source Files\cryptopp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cryptopp\sha.cpp">
|
||||
<Filter>Source Files\cryptopp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="database\database.cpp">
|
||||
<Filter>Header Files\util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="database\SqliteDatabase.cpp">
|
||||
<Filter>Header Files\util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="database\sqlite3.c">
|
||||
<Filter>Header Files\util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Conversion.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AccountState.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DeterministicKeys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SHAMap.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SHAMapDiff.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SHAMapNodes.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Serializer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Transaction.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="json\json_reader.cpp">
|
||||
<Filter>Source Files\json</Filter>
|
||||
</ClCompile>
|
||||
@@ -150,25 +60,181 @@
|
||||
<ClCompile Include="json\json_writer.cpp">
|
||||
<Filter>Source Files\json</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LocalTransaction.cpp">
|
||||
<ClCompile Include="src\AccountState.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PubKeyCache.cpp">
|
||||
<ClCompile Include="src\Amount.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HashedObject.cpp">
|
||||
<ClCompile Include="src\Application.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="NetworkOPs.cpp">
|
||||
<ClCompile Include="src\CallRPC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DBInit.cpp">
|
||||
<ClCompile Include="src\Config.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.cpp">
|
||||
<ClCompile Include="src\ConnectionPool.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CallRPC.cpp">
|
||||
<ClCompile Include="src\Conversion.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Currency.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\DBInit.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\DeterministicKeys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\ECIES.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Hanko.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\HashedObject.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\HttpsClient.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Ledger.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LedgerAcquire.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LedgerFormats.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LedgerHistory.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LedgerIndex.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LedgerMaster.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LedgerNode.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LocalTransaction.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\NetworkOPs.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\NewcoinAddress.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\PackedMessage.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\ParseSection.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Peer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\PeerDoor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\PlatRand.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\PubKeyCache.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\RequestParser.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\rfc1751.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\rpc.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\RPCCommands.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\RPCDoor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\RPCServer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SerializedLedger.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SerializedObject.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SerializedTransaction.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SerializedTypes.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SerializedValidation.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Serializer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SHAMap.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SHAMapDiff.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SHAMapNodes.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SHAMapSync.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Transaction.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\TransactionEngine.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\TransactionFormats.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\TransactionMaster.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\UniqueNodeList.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\utils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Wallet.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\BitcoinUtil.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="database\database.cpp">
|
||||
<Filter>Source Files\database</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="database\SqliteDatabase.cpp">
|
||||
<Filter>Source Files\database</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="database\win\windatabase.cpp">
|
||||
<Filter>Source Files\database</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="obj\src\newcoin.pb.cc">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
@@ -242,9 +308,6 @@
|
||||
<ClInclude Include="TransactionBundle.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="newcoin.pb.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PackedMessage.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -341,6 +404,9 @@
|
||||
<ClInclude Include="SecureAllocator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="obj\src\newcoin.pb.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="nodes.xml" />
|
||||
@@ -357,8 +423,9 @@
|
||||
<None Include="tests\client2\config.xml">
|
||||
<Filter>tests\client2</Filter>
|
||||
</None>
|
||||
<None Include="SConstruct" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="newcoin.proto" />
|
||||
<CustomBuild Include="src\newcoin.proto" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -54,6 +54,6 @@ double Amount::getDisplayQuantity() const
|
||||
{
|
||||
if(!mCurrency.isNational()) throw std::runtime_error("Can only scale national currencies");
|
||||
int scale=mCurrency.getScale();
|
||||
return static_cast<double>(mQuantity) * pow(10, 128-scale);
|
||||
return static_cast<double>(mQuantity) * pow((double)10, 128-scale);
|
||||
}
|
||||
|
||||
|
||||
14
src/Ledger.h
14
src/Ledger.h
@@ -18,17 +18,17 @@
|
||||
|
||||
enum LedgerStateParms
|
||||
{
|
||||
lepNONE = 0, // no special flags
|
||||
lepNONE = 0, // no special flags
|
||||
|
||||
// input flags
|
||||
lepCREATE, // Create if not present
|
||||
lepCREATE = 1, // Create if not present
|
||||
|
||||
// output flags
|
||||
lepOKAY, // success
|
||||
lepMISSING, // No node in that slot
|
||||
lepWRONGTYPE, // Node of different type there
|
||||
lepCREATED, // Node was created
|
||||
lepERROR, // error
|
||||
lepOKAY = 2, // success
|
||||
lepMISSING = 4, // No node in that slot
|
||||
lepWRONGTYPE = 8, // Node of different type there
|
||||
lepCREATED = 16, // Node was created
|
||||
lepERROR = 32, // error
|
||||
};
|
||||
|
||||
class Ledger : public boost::enable_shared_from_this<Ledger>
|
||||
|
||||
@@ -55,11 +55,11 @@ LedgerEntryFormat LedgerFormats[]=
|
||||
|
||||
LedgerEntryFormat* getLgrFormat(LedgerEntryType t)
|
||||
{
|
||||
LedgerEntryFormat* f=LedgerFormats;
|
||||
while(f->t_name!=NULL)
|
||||
LedgerEntryFormat* f = LedgerFormats;
|
||||
while(f->t_name != NULL)
|
||||
{
|
||||
if(f->t_type==t) return f;
|
||||
f++;
|
||||
if(f->t_type == t) return f;
|
||||
++f;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
bool AddSystemEntropy()
|
||||
{ // Get entropy from the Windows crypto provider
|
||||
RAND_screen(); // this isn't really that safe since it only works for end users not servers
|
||||
|
||||
/* TODO: you need the cryptoAPI installed I think for the below to work. I suppose we should require people to install this to build the windows version
|
||||
char name[512], rand[128];
|
||||
DWORD count = 500;
|
||||
HCRYPTOPROV cryptoHandle;
|
||||
@@ -39,6 +42,8 @@ bool AddSystemEntropy()
|
||||
|
||||
CryptReleaseContext(cryptoHandle, 0);
|
||||
RAND_seed(rand, 128);
|
||||
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/smart_ptr/make_shared.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include "Serializer.h"
|
||||
#include "BitcoinUtil.h"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <boost/smart_ptr/make_shared.hpp>
|
||||
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#include <iostream>
|
||||
#include "Serializer.h"
|
||||
#include "BitcoinUtil.h"
|
||||
#include "SHAMap.h"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#include <iostream>
|
||||
#include "SHAMap.h"
|
||||
|
||||
void SHAMap::getMissingNodes(std::vector<SHAMapNode>& nodeIDs, std::vector<uint256>& hashes, int max)
|
||||
|
||||
@@ -117,7 +117,7 @@ STObject::STObject(SOElement* elem, SerializerIterator& sit, const char *name) :
|
||||
if ((flags&elem->e_flags) == 0)
|
||||
{
|
||||
done = true;
|
||||
giveObject(makeDefaultObject(elem->e_id, elem->e_name));
|
||||
giveObject(makeDefaultObject(STI_NOTPRESENT, elem->e_name));
|
||||
}
|
||||
}
|
||||
else if (elem->e_type == SOE_IFNFLAG)
|
||||
@@ -126,7 +126,7 @@ STObject::STObject(SOElement* elem, SerializerIterator& sit, const char *name) :
|
||||
if ((flags&elem->e_flags) != 0)
|
||||
{
|
||||
done = true;
|
||||
giveObject(makeDefaultObject(STI_NOTPRESENT, elem->e_name));
|
||||
giveObject(makeDefaultObject(elem->e_id, elem->e_name));
|
||||
}
|
||||
}
|
||||
else if (elem->e_type == SOE_FLAGS)
|
||||
|
||||
@@ -191,12 +191,13 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
|
||||
// WRITEME: Special case code for changing transaction key
|
||||
for (std::vector<AffectedAccount>::iterator it=accounts.begin(), end=accounts.end();
|
||||
it != end; ++it)
|
||||
{ if (it->first == taaCREATE)
|
||||
{
|
||||
if (it->first == taaCREATE)
|
||||
{
|
||||
if (mLedger->writeBack(lepCREATE, it->second) & lepERROR)
|
||||
assert(false);
|
||||
}
|
||||
else if (it->first==taaMODIFY)
|
||||
else if (it->first == taaMODIFY)
|
||||
{
|
||||
if (mLedger->writeBack(lepNONE, it->second) & lepERROR)
|
||||
assert(false);
|
||||
@@ -235,7 +236,7 @@ TransactionEngineResult TransactionEngine::doClaim(const SerializedTransaction&
|
||||
}
|
||||
|
||||
LedgerStateParms qry = lepNONE;
|
||||
SerializedLedgerEntry::pointer dest = mLedger->getAccountRoot(qry, sourceAccountID);
|
||||
SerializedLedgerEntry::pointer dest = accounts[0].second;
|
||||
|
||||
if (!dest)
|
||||
{
|
||||
@@ -271,8 +272,6 @@ TransactionEngineResult TransactionEngine::doClaim(const SerializedTransaction&
|
||||
// Set the public key needed to use the account.
|
||||
dest->setIFieldH160(sfAuthorizedKey, hGeneratorID);
|
||||
|
||||
accounts.push_back(std::make_pair(taaMODIFY, dest));
|
||||
|
||||
// Construct a generator map entry.
|
||||
gen = boost::make_shared<SerializedLedgerEntry>(ltGENERATOR_MAP);
|
||||
|
||||
@@ -295,6 +294,8 @@ TransactionEngineResult TransactionEngine::doPayment(const SerializedTransaction
|
||||
// Does the destination account exist?
|
||||
if (!destAccount) return tenINVALID;
|
||||
LedgerStateParms qry = lepNONE;
|
||||
|
||||
// FIXME: If this transfer is to the same account, bad things will happen
|
||||
SerializedLedgerEntry::pointer dest = mLedger->getAccountRoot(qry, destAccount);
|
||||
if (!dest)
|
||||
{ // can this transaction create an account
|
||||
|
||||
@@ -55,11 +55,11 @@ TransactionFormat InnerTxnFormats[]=
|
||||
|
||||
TransactionFormat* getTxnFormat(TransactionType t)
|
||||
{
|
||||
TransactionFormat* f=InnerTxnFormats;
|
||||
while(f->t_name!=NULL)
|
||||
TransactionFormat* f = InnerTxnFormats;
|
||||
while(f->t_name != NULL)
|
||||
{
|
||||
if(f->t_type==t) return f;
|
||||
f++;
|
||||
if(f->t_type == t) return f;
|
||||
++f;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ int main(int argc, char* argv[])
|
||||
pvCmd.push_back(const_cast<char*>(param.c_str()));
|
||||
}
|
||||
|
||||
iResult = unit_test_main(init_unit_test, iCmd, &pvCmd[0]);
|
||||
// iResult = unit_test_main(init_unit_test, iCmd, &pvCmd[0]);
|
||||
}
|
||||
else if (!vm.count("parameters"))
|
||||
{
|
||||
|
||||
@@ -4,4 +4,3 @@ REM copy C:\code\newcoin\Release\newcoin.exe C:\code\newcoin\tests\client2
|
||||
copy d:\code\newcoin\Debug\newcoin.exe d:\code\newcoin\tests\client1
|
||||
copy d:\code\newcoin\Debug\newcoin.exe d:\code\newcoin\tests\client2
|
||||
|
||||
pause
|
||||
Reference in New Issue
Block a user