diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/consensus/consensus.db b/3rd-party/Sia-v1.1.0-windows-amd64/data0/consensus/consensus.db new file mode 100644 index 0000000..6e6531a Binary files /dev/null and b/3rd-party/Sia-v1.1.0-windows-amd64/data0/consensus/consensus.db differ diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/consensus/consensus.db.lock b/3rd-party/Sia-v1.1.0-windows-amd64/data0/consensus/consensus.db.lock new file mode 100644 index 0000000..e69de29 diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/host.db b/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/host.db new file mode 100644 index 0000000..b2e12d0 Binary files /dev/null and b/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/host.db differ diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/host.db.lock b/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/host.db.lock new file mode 100644 index 0000000..e69de29 diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/host.json b/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/host.json new file mode 100644 index 0000000..8afec42 --- /dev/null +++ b/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/host.json @@ -0,0 +1,152 @@ +"Sia Host" +"0.5" +{ + "downloadcalls": 0, + "erroredcalls": 0, + "formcontractcalls": 0, + "renewcalls": 0, + "revisecalls": 0, + "recentrevisioncalls": 0, + "settingscalls": 0, + "unrecognizedcalls": 0, + "blockheight": 0, + "recentchange": [ + 137, + 234, + 215, + 246, + 113, + 128, + 162, + 143, + 91, + 45, + 234, + 33, + 63, + 219, + 182, + 103, + 59, + 145, + 74, + 121, + 1, + 55, + 90, + 120, + 3, + 53, + 73, + 51, + 126, + 197, + 218, + 192 + ], + "announced": false, + "autoaddress": "", + "financialmetrics": { + "contractcount": 0, + "contractcompensation": "0", + "potentialcontractcompensation": "0", + "lockedstoragecollateral": "0", + "lostrevenue": "0", + "loststoragecollateral": "0", + "potentialstoragerevenue": "0", + "riskedstoragecollateral": "0", + "storagerevenue": "0", + "transactionfeeexpenses": "0", + "downloadbandwidthrevenue": "0", + "potentialdownloadbandwidthrevenue": "0", + "potentialuploadbandwidthrevenue": "0", + "uploadbandwidthrevenue": "0" + }, + "publickey": { + "algorithm": "ed25519", + "key": "lTMXt28S5M5FkAwyMf8UCJF+ZEnfTjQLFCGs/4kJjJc=" + }, + "revisionnumber": 0, + "secretkey": [ + 147, + 23, + 32, + 167, + 207, + 22, + 186, + 70, + 141, + 121, + 52, + 206, + 29, + 57, + 207, + 229, + 254, + 217, + 236, + 113, + 25, + 235, + 127, + 25, + 112, + 255, + 168, + 1, + 130, + 120, + 26, + 142, + 149, + 51, + 23, + 183, + 111, + 18, + 228, + 206, + 69, + 144, + 12, + 50, + 49, + 255, + 20, + 8, + 145, + 126, + 100, + 73, + 223, + 78, + 52, + 11, + 20, + 33, + 172, + 255, + 137, + 9, + 140, + 151 + ], + "settings": { + "acceptingcontracts": false, + "maxdownloadbatchsize": 17825792, + "maxduration": 25920, + "maxrevisebatchsize": 17825792, + "netaddress": "", + "windowsize": 144, + "collateral": "115740740740", + "collateralbudget": "2000000000000000000000000000000", + "maxcollateral": "100000000000000000000000000000", + "mincontractprice": "20000000000000000000000000", + "mindownloadbandwidthprice": "250000000000000", + "minstorageprice": "115740740740", + "minuploadbandwidthprice": "10000000000000" + }, + "unlockhash": "000000000000000000000000000000000000000000000000000000000000000089eb0d6a8a69" +} \ No newline at end of file diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/storagemanager/storagemanager.db b/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/storagemanager/storagemanager.db new file mode 100644 index 0000000..f053e4c Binary files /dev/null and b/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/storagemanager/storagemanager.db differ diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/storagemanager/storagemanager.db.lock b/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/storagemanager/storagemanager.db.lock new file mode 100644 index 0000000..e69de29 diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/storagemanager/storagemanager.json b/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/storagemanager/storagemanager.json new file mode 100644 index 0000000..ff672ca --- /dev/null +++ b/3rd-party/Sia-v1.1.0-windows-amd64/data0/host/storagemanager/storagemanager.json @@ -0,0 +1,6 @@ +"Sia Storage Manager" +"0.6.0" +{ + "SectorSalt": "280618ece27645a22dc075d48938f33410b8056bc3aab3e2eb86dcb7f4fe7d0f", + "StorageFolders": null +} \ No newline at end of file diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/miner/miner.json b/3rd-party/Sia-v1.1.0-windows-amd64/data0/miner/miner.json new file mode 100644 index 0000000..d07b40e --- /dev/null +++ b/3rd-party/Sia-v1.1.0-windows-amd64/data0/miner/miner.json @@ -0,0 +1,91 @@ +"Miner Settings" +"0.5.0" +{ + "RecentChange": [ + 137, + 234, + 215, + 246, + 113, + 128, + 162, + 143, + 91, + 45, + 234, + 33, + 63, + 219, + 182, + 103, + 59, + 145, + 74, + 121, + 1, + 55, + 90, + 120, + 3, + 53, + 73, + 51, + 126, + 197, + 218, + 192 + ], + "Height": 0, + "Target": [ + 0, + 0, + 0, + 0, + 32, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "Address": "000000000000000000000000000000000000000000000000000000000000000089eb0d6a8a69", + "BlocksFound": null, + "UnsolvedBlock": { + "parentid": "25f6e3b9295a61f69fcb956aca9f0076234ecf2e02d399db5448b6e22f26e81c", + "nonce": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "timestamp": 1433600000, + "minerpayouts": null, + "transactions": null + } +} \ No newline at end of file diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/renter/contractor.json b/3rd-party/Sia-v1.1.0-windows-amd64/data0/renter/contractor.json new file mode 100644 index 0000000..5088d28 --- /dev/null +++ b/3rd-party/Sia-v1.1.0-windows-amd64/data0/renter/contractor.json @@ -0,0 +1,56 @@ +"Contractor Persistence" +"0.5.2" +{ + "Allowance": { + "funds": "0", + "hosts": 0, + "period": 0, + "renewwindow": 0 + }, + "BlockHeight": 0, + "CachedRevisions": null, + "Contracts": null, + "CurrentPeriod": 0, + "LastChange": [ + 137, + 234, + 215, + 246, + 113, + 128, + 162, + 143, + 91, + 45, + 234, + 33, + 63, + 219, + 182, + 103, + 59, + 145, + 74, + 121, + 1, + 55, + 90, + 120, + 3, + 53, + 73, + 51, + 126, + 197, + 218, + 192 + ], + "OldContracts": null, + "RenewedIDs": {}, + "FinancialMetrics": { + "contractspending": "0", + "downloadspending": "0", + "storagespending": "0", + "uploadspending": "0" + } +} \ No newline at end of file diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/renter/hostdb.json b/3rd-party/Sia-v1.1.0-windows-amd64/data0/renter/hostdb.json new file mode 100644 index 0000000..e9ce96d --- /dev/null +++ b/3rd-party/Sia-v1.1.0-windows-amd64/data0/renter/hostdb.json @@ -0,0 +1,40 @@ +"HostDB Persistence" +"0.5" +{ + "AllHosts": null, + "ActiveHosts": null, + "LastChange": [ + 137, + 234, + 215, + 246, + 113, + 128, + 162, + 143, + 91, + 45, + 234, + 33, + 63, + 219, + 182, + 103, + 59, + 145, + 74, + 121, + 1, + 55, + 90, + 120, + 3, + 53, + 73, + 51, + 126, + 197, + 218, + 192 + ] +} \ No newline at end of file diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/transactionpool/transactionpool.db b/3rd-party/Sia-v1.1.0-windows-amd64/data0/transactionpool/transactionpool.db new file mode 100644 index 0000000..a64ea89 Binary files /dev/null and b/3rd-party/Sia-v1.1.0-windows-amd64/data0/transactionpool/transactionpool.db differ diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/transactionpool/transactionpool.db.lock b/3rd-party/Sia-v1.1.0-windows-amd64/data0/transactionpool/transactionpool.db.lock new file mode 100644 index 0000000..e69de29 diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/wallet/Sia Wallet Encrypted Backup Seed - 63AIQ4S4THCDEGDNFGHT.seed b/3rd-party/Sia-v1.1.0-windows-amd64/data0/wallet/Sia Wallet Encrypted Backup Seed - 63AIQ4S4THCDEGDNFGHT.seed new file mode 100644 index 0000000..8f98b34 --- /dev/null +++ b/3rd-party/Sia-v1.1.0-windows-amd64/data0/wallet/Sia Wallet Encrypted Backup Seed - 63AIQ4S4THCDEGDNFGHT.seed @@ -0,0 +1,40 @@ +"Wallet Seed" +"0.4.0" +{ + "UID": [ + 234, + 179, + 222, + 70, + 130, + 85, + 109, + 55, + 224, + 207, + 73, + 71, + 149, + 106, + 142, + 209, + 115, + 191, + 101, + 219, + 162, + 98, + 183, + 114, + 160, + 122, + 197, + 33, + 65, + 169, + 130, + 144 + ], + "EncryptionVerification": "3fiegFXRw7lRFuNebhtOWdHfad9IVjwqiA4yScakWRwgt84qu0ZRsWjmYqAwyJLQ0JHPcAqu9xYuK6FN", + "Seed": "ibLaavbG7PgvlvsQbuUSa3udZknGVN4lrtWtVN/1et5/9mGY8vDw+e7EhkgXRZyEKEjAU8nztAmFiZ+l" +} \ No newline at end of file diff --git a/3rd-party/Sia-v1.1.0-windows-amd64/data0/wallet/wallet.json b/3rd-party/Sia-v1.1.0-windows-amd64/data0/wallet/wallet.json new file mode 100644 index 0000000..faf2d10 --- /dev/null +++ b/3rd-party/Sia-v1.1.0-windows-amd64/data0/wallet/wallet.json @@ -0,0 +1,80 @@ +"Wallet Settings" +"0.4.0" +{ + "UID": [ + 113, + 245, + 186, + 210, + 209, + 191, + 36, + 201, + 81, + 222, + 226, + 105, + 185, + 22, + 6, + 119, + 12, + 175, + 124, + 99, + 238, + 248, + 20, + 223, + 93, + 175, + 1, + 203, + 127, + 197, + 251, + 226 + ], + "EncryptionVerification": "4FQGlRV8zJ9SYD67UrRJKCxsF6hREVebOyQgm+zQgkIw6imwW1/TSn66NV/hD4VHFkWE9VJktzKV/Azr", + "PrimarySeedFile": { + "UID": [ + 234, + 179, + 222, + 70, + 130, + 85, + 109, + 55, + 224, + 207, + 73, + 71, + 149, + 106, + 142, + 209, + 115, + 191, + 101, + 219, + 162, + 98, + 183, + 114, + 160, + 122, + 197, + 33, + 65, + 169, + 130, + 144 + ], + "EncryptionVerification": "3fiegFXRw7lRFuNebhtOWdHfad9IVjwqiA4yScakWRwgt84qu0ZRsWjmYqAwyJLQ0JHPcAqu9xYuK6FN", + "Seed": "ibLaavbG7PgvlvsQbuUSa3udZknGVN4lrtWtVN/1et5/9mGY8vDw+e7EhkgXRZyEKEjAU8nztAmFiZ+l" + }, + "PrimarySeedProgress": 1, + "AuxiliarySeedFiles": null, + "UnseededKeys": null +} \ No newline at end of file diff --git a/UnitTests/UnitTestConfig.cpp b/UnitTests/UnitTestConfig.cpp new file mode 100644 index 0000000..b97ebe3 --- /dev/null +++ b/UnitTests/UnitTestConfig.cpp @@ -0,0 +1,93 @@ +#include "stdafx.h" +#include +#include "UnitTestConfig.h" + +std::uint16_t Daemon::_iter = 0; + +Daemon::Daemon() +{ + _i = _iter++; + Cleanup(); +} + +Daemon::~Daemon() +{ + Stop(); + Cleanup(); +} + +BOOL Daemon::DirectoryExists(const String& path) +{ + DWORD dwAttrib = GetFileAttributes(path.c_str()); + return ((dwAttrib != INVALID_FILE_ATTRIBUTES) && (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)); +} + +void Daemon::Cleanup() +{ + BOOL failed = TRUE; + String path; + path.resize(MAX_PATH + 1); + GetFullPathName((L"\"..\\..\\..\\..\\3rd-party\\Sia-v1.1.0-windows-amd64\\data" + std::to_wstring(_i)).c_str(), MAX_PATH, &path[0], nullptr); + while (failed) + { + PROCESS_INFORMATION pi2; + STARTUPINFO si2; + ZeroMemory(&si2, sizeof(si2)); + si2.cb = sizeof(si2); + ZeroMemory(&pi2, sizeof(pi2)); + + String szCmdline = L"cmd.exe /c del /s /q \"" + path + L"\""; + CreateProcess(nullptr, &szCmdline[0], nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si2, &pi2); + if (!(failed = (pi2.hProcess == 0))) + { + WaitForSingleObject(pi2.hProcess, INFINITE); + + CloseHandle(pi2.hProcess); + CloseHandle(pi2.hThread); + } + + ZeroMemory(&si2, sizeof(si2)); + si2.cb = sizeof(si2); + ZeroMemory(&pi2, sizeof(pi2)); + + szCmdline = L"cmd.exe /c rd /s /q \"" + path + L"\""; + CreateProcess(nullptr, &szCmdline[0], nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si2, &pi2); + if (!(failed = (pi2.hProcess == 0))) + { + WaitForSingleObject(pi2.hProcess, INFINITE); + + CloseHandle(pi2.hProcess); + CloseHandle(pi2.hThread); + } + Sleep(100); + } +} + +void Daemon::Start() +{ + String path; + path.resize(MAX_PATH + 1); + GetFullPathName(L"\"..\\..\\..\\..\\3rd-party\\Sia-v1.1.0-windows-amd64\\", MAX_PATH, &path[0], nullptr); + + String exec; + exec.resize(MAX_PATH + 1); + GetFullPathName(L"\"..\\..\\..\\..\\3rd-party\\Sia-v1.1.0-windows-amd64\\siad.exe", MAX_PATH, &exec[0], nullptr); + + String szCmdline = L" -d .\\data" + std::to_wstring(_i) + L" --api-addr " + String(TEST_SERVER_HOST) + L":" + std::to_wstring(TEST_SERVER_PORT) + L" --no-bootstrap"; + CreateProcess(exec.c_str(), &szCmdline[0], nullptr, nullptr, FALSE, 0, nullptr, path.c_str(), &si, &pi); +} + +void Daemon::Stop() +{ + if (pi.hProcess) + { + TerminateProcess(pi.hProcess, -1); + + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + ZeroMemory(&pi, sizeof(pi)); + } +} \ No newline at end of file diff --git a/UnitTests/UnitTestConfig.h b/UnitTests/UnitTestConfig.h index 410ecb6..27034eb 100644 --- a/UnitTests/UnitTestConfig.h +++ b/UnitTests/UnitTestConfig.h @@ -10,58 +10,26 @@ using namespace Sia::Api; class Daemon { public: - ~Daemon() - { - Stop(); - } + Daemon(); + +public: + ~Daemon(); private: + static std::uint16_t _iter; + std::uint16_t _i; PROCESS_INFORMATION pi; STARTUPINFO si; private: - void Cleanup() - { - ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - ZeroMemory(&pi, sizeof(pi)); + BOOL DirectoryExists(const String& path); - String szCmdline = L"cmd.exe /c del /s /q .\\data"; - CreateProcess(nullptr, &szCmdline[0], nullptr, nullptr, TRUE, 0, nullptr, nullptr, &si, &pi); - if (pi.hProcess) - { - WaitForSingleObject(pi.hProcess, INFINITE); - - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - } - - ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - ZeroMemory(&pi, sizeof(pi)); - } + void Cleanup(); public: - void Start() - { - Cleanup(); + void Start(); - String szCmdline = L"\"..\\..\\3rd-party\\Sia-v1.1.0-windows-amd64\\siad.exe\" -d .\\data --api-addr " + String(TEST_SERVER_HOST) + L":" + std::to_wstring(TEST_SERVER_PORT) + L" --no-bootstrap"; - CreateProcess(nullptr, &szCmdline[0], nullptr, nullptr, TRUE, 0, nullptr, nullptr, &si, &pi); - } - - void Stop() - { - if (pi.hProcess) - { - TerminateProcess(pi.hProcess, 0); - - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - - Cleanup(); - } - } + void Stop(); }; #define DAEMON_TEST() \ @@ -80,4 +48,4 @@ public: } -#define DEFINE_DAEMON(class) Daemon class::_daemon \ No newline at end of file +#define DEFINE_DAEMON(class) Daemon class::_daemon; diff --git a/UnitTests/UnitTests.vcxproj b/UnitTests/UnitTests.vcxproj index c8db1be..841f870 100644 --- a/UnitTests/UnitTests.vcxproj +++ b/UnitTests/UnitTests.vcxproj @@ -182,6 +182,7 @@ Create + diff --git a/UnitTests/UnitTests.vcxproj.filters b/UnitTests/UnitTests.vcxproj.filters index 608a1a4..17ea9f3 100644 --- a/UnitTests/UnitTests.vcxproj.filters +++ b/UnitTests/UnitTests.vcxproj.filters @@ -44,5 +44,8 @@ Source Files + + Source Files + \ No newline at end of file