From 51cb83bd084deaab038e6f328ff2af56a3a0bd16 Mon Sep 17 00:00:00 2001 From: subtly Date: Sun, 17 May 2015 14:38:09 +0200 Subject: [PATCH 01/13] GetFolderPathW needs wchar_t and can otherwise fail (returning an invalid path) and use AppData path instead of users home directory. Use Local AppData instead of roaming to users on domain networks aren't uploading DAG files to servers. --- libethash/io_win32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libethash/io_win32.c b/libethash/io_win32.c index 2e6c8deb8..34f1aaa77 100644 --- a/libethash/io_win32.c +++ b/libethash/io_win32.c @@ -87,9 +87,9 @@ bool ethash_file_size(FILE* f, size_t* ret_size) bool ethash_get_default_dirname(char* strbuf, size_t buffsize) { - static const char dir_suffix[] = "Appdata\\Ethash\\"; + static const char dir_suffix[] = "Ethash\\"; strbuf[0] = '\0'; - if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, (WCHAR*)strbuf))) { + if (!SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, (CHAR*)strbuf))) { return false; } if (!ethash_strncat(strbuf, buffsize, "\\", 1)) { From e7a0b94786f1493fa1176bf47551eec832990cac Mon Sep 17 00:00:00 2001 From: subtly Date: Sun, 17 May 2015 19:00:58 +0200 Subject: [PATCH 02/13] Trigger dag creation prior to mining until threading on windows is sorted. Delete miner when returning early from gpu miner doWork so that in the event that abort is called prior to miner initializing, miner is still initialized. --- ethminer/main.cpp | 5 +++-- libethcore/Ethash.cpp | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ethminer/main.cpp b/ethminer/main.cpp index 97e125e65..bcb33915f 100644 --- a/ethminer/main.cpp +++ b/ethminer/main.cpp @@ -250,10 +250,11 @@ void doFarm(MinerType _m, string const& _remote, unsigned _recheckPeriod) cnote << "Getting work package..."; Json::Value v = rpc.eth_getWork(); h256 hh(v[0].asString()); - if (hh != current.headerHash) + h256 newSeedHash(v[1].asString()); + if (hh != current.headerHash && !!EthashAux::full(newSeedHash, true)) { current.headerHash = hh; - current.seedHash = h256(v[1].asString()); + current.seedHash = newSeedHash; current.boundary = h256(fromHex(v[2].asString()), h256::AlignRight); cnote << "Got work package:"; cnote << " Header-hash:" << current.headerHash.hex(); diff --git a/libethcore/Ethash.cpp b/libethcore/Ethash.cpp index ff7fe47e7..72c340f70 100644 --- a/libethcore/Ethash.cpp +++ b/libethcore/Ethash.cpp @@ -319,7 +319,10 @@ void Ethash::GPUMiner::workLoop() if ((dag = EthashAux::full(w.seedHash, false))) break; if (shouldStop()) + { + delete m_miner; return; + } cnote << "Awaiting DAG"; this_thread::sleep_for(chrono::milliseconds(500)); } From 68099a7c8ea16052d5cb14326345e2f89676a366 Mon Sep 17 00:00:00 2001 From: subtly Date: Sun, 17 May 2015 23:10:50 +0200 Subject: [PATCH 03/13] Normalize ethash filepath for macos to be same as others. --- ethminer/main.cpp | 5 ++++- libethash/io_posix.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ethminer/main.cpp b/ethminer/main.cpp index bcb33915f..c5fa968a7 100644 --- a/ethminer/main.cpp +++ b/ethminer/main.cpp @@ -251,7 +251,10 @@ void doFarm(MinerType _m, string const& _remote, unsigned _recheckPeriod) Json::Value v = rpc.eth_getWork(); h256 hh(v[0].asString()); h256 newSeedHash(v[1].asString()); - if (hh != current.headerHash && !!EthashAux::full(newSeedHash, true)) + if (!EthashAux::full(newSeedHash, true)) + BOOST_THROW_EXCEPTION(DAGCreationFailure()); + + if (hh != current.headerHash) { current.headerHash = hh; current.seedHash = newSeedHash; diff --git a/libethash/io_posix.c b/libethash/io_posix.c index 7f03d5482..b030748a9 100644 --- a/libethash/io_posix.c +++ b/libethash/io_posix.c @@ -26,6 +26,10 @@ #include #include #include +#if defined(__APPLE__) +#include +#include +#endif FILE* ethash_fopen(char const* file_name, char const* mode) { @@ -86,9 +90,22 @@ bool ethash_file_size(FILE* f, size_t* ret_size) bool ethash_get_default_dirname(char* strbuf, size_t buffsize) { +#if defined(__APPLE__) + static const char dir_suffix[] = "Ethash/"; + strbuf[0] = '\0'; + char* home_dir = getenv("HOME"); + if (!home_dir || strlen(home_dir) == 0) + { + struct passwd* pwd = getpwuid(getuid()); + if (pwd) + home_dir = pwd->pw_dir; + } +#else static const char dir_suffix[] = ".ethash/"; strbuf[0] = '\0'; char* home_dir = getenv("HOME"); +#endif + size_t len = strlen(home_dir); if (!ethash_strncat(strbuf, buffsize, home_dir, len)) { return false; From 5d759f549b770455d8c1668b03c82b145897d65b Mon Sep 17 00:00:00 2001 From: arkpar Date: Mon, 18 May 2015 15:14:48 +0200 Subject: [PATCH 04/13] mix bugfixes --- mix/ClientModel.cpp | 151 ++++++++++++------------------- mix/qml.qrc | 1 - mix/qml/ContractLibrary.qml | 27 ------ mix/qml/StateListModel.qml | 29 +----- mix/qml/TransactionDialog.qml | 2 + mix/qml/html/cm/codemirror.css | 4 + mix/qml/html/cm/solidityToken.js | 2 +- 7 files changed, 68 insertions(+), 148 deletions(-) delete mode 100644 mix/qml/ContractLibrary.qml diff --git a/mix/ClientModel.cpp b/mix/ClientModel.cpp index 7638db635..54d5db2b5 100644 --- a/mix/ClientModel.cpp +++ b/mix/ClientModel.cpp @@ -256,32 +256,17 @@ void ClientModel::setupState(QVariantMap _state) u256 value = (qvariant_cast(transaction.value("value")))->toU256Wei(); u256 gasPrice = (qvariant_cast(transaction.value("gasPrice")))->toU256Wei(); QString sender = transaction.value("sender").toString(); - bool isStdContract = transaction.value("stdContract").toBool(); bool isContractCreation = transaction.value("isContractCreation").toBool(); bool isFunctionCall = transaction.value("isFunctionCall").toBool(); - if (isStdContract) - { - if (contractId.isEmpty()) //TODO: This is to support old project files, remove later - contractId = functionId; - TransactionSettings transactionSettings(contractId, transaction.value("url").toString()); - transactionSettings.gasPrice = 10000000000000; - transactionSettings.gasAuto = true; - transactionSettings.value = 0; - transactionSettings.sender = Secret(sender.toStdString()); - transactionSequence.push_back(transactionSettings); - } - else - { - if (contractId.isEmpty() && m_codeModel->hasContract()) //TODO: This is to support old project files, remove later - contractId = m_codeModel->contracts().keys()[0]; - TransactionSettings transactionSettings(contractId, functionId, value, gas, gasAuto, gasPrice, Secret(sender.toStdString()), isContractCreation, isFunctionCall); - transactionSettings.parameterValues = transaction.value("parameters").toMap(); + if (contractId.isEmpty() && m_codeModel->hasContract()) //TODO: This is to support old project files, remove later + contractId = m_codeModel->contracts().keys()[0]; + TransactionSettings transactionSettings(contractId, functionId, value, gas, gasAuto, gasPrice, Secret(sender.toStdString()), isContractCreation, isFunctionCall); + transactionSettings.parameterValues = transaction.value("parameters").toMap(); - if (contractId == functionId || functionId == "Constructor") - transactionSettings.functionId.clear(); + if (contractId == functionId || functionId == "Constructor") + transactionSettings.functionId.clear(); - transactionSequence.push_back(transactionSettings); - } + transactionSequence.push_back(transactionSettings); } m_ethAccounts->setAccounts(userAccounts); executeSequence(transactionSequence, accounts, Secret(_state.value("miner").toMap().value("secret").toString().toStdString())); @@ -319,79 +304,66 @@ void ClientModel::executeSequence(vector const& _sequence, continue; } ContractCallDataEncoder encoder; - if (!transaction.stdContractUrl.isEmpty()) + //encode data + CompiledContract const& compilerRes = m_codeModel->contract(ctrInstance.first); + QFunctionDefinition const* f = nullptr; + bytes contractCode = compilerRes.bytes(); + shared_ptr contractDef = compilerRes.sharedContract(); + if (transaction.functionId.isEmpty()) + f = contractDef->constructor(); + else + for (QFunctionDefinition const* tf: contractDef->functionsList()) + if (tf->name() == transaction.functionId) + { + f = tf; + break; + } + if (!f) { - //std contract - bytes const& stdContractCode = m_codeModel->getStdContractCode(transaction.contractId, transaction.stdContractUrl); - TransactionSettings stdTransaction = transaction; - stdTransaction.gasAuto = true; - Address address = deployContract(stdContractCode, stdTransaction); - m_stdContractAddresses[stdTransaction.contractId] = address; - m_stdContractNames[address] = stdTransaction.contractId; + emit runFailed("Function '" + transaction.functionId + tr("' not found. Please check transactions or the contract code.")); + m_running = false; + emit runStateChanged(); + return; + } + if (!transaction.functionId.isEmpty()) + encoder.encode(f); + for (QVariableDeclaration const* p: f->parametersList()) + { + QSolidityType const* type = p->type(); + QVariant value = transaction.parameterValues.value(p->name()); + if (type->type().type == SolidityType::Type::Address) + { + std::pair ctrParamInstance = resolvePair(value.toString()); + value = QVariant(resolveToken(ctrParamInstance, deployedContracts)); + } + encoder.encode(value, type->type()); + } + + if (transaction.functionId.isEmpty() || transaction.functionId == ctrInstance.first) + { + bytes param = encoder.encodedData(); + contractCode.insert(contractCode.end(), param.begin(), param.end()); + Address newAddress = deployContract(contractCode, transaction); + deployedContracts.push_back(newAddress); + std::pair contractToken = retrieveToken(transaction.contractId, deployedContracts); + m_contractAddresses[contractToken] = newAddress; + m_contractNames[newAddress] = contractToken.first; + contractAddressesChanged(); + gasCostsChanged(); } else { - //encode data - CompiledContract const& compilerRes = m_codeModel->contract(ctrInstance.first); - QFunctionDefinition const* f = nullptr; - bytes contractCode = compilerRes.bytes(); - shared_ptr contractDef = compilerRes.sharedContract(); - if (transaction.functionId.isEmpty()) - f = contractDef->constructor(); - else - for (QFunctionDefinition const* tf: contractDef->functionsList()) - if (tf->name() == transaction.functionId) - { - f = tf; - break; - } - if (!f) + auto contractAddressIter = m_contractAddresses.find(ctrInstance); + if (contractAddressIter == m_contractAddresses.end()) { - emit runFailed("Function '" + transaction.functionId + tr("' not found. Please check transactions or the contract code.")); + emit runFailed("Contract '" + transaction.contractId + tr(" not deployed.") + "' " + tr(" Cannot call ") + transaction.functionId); m_running = false; emit runStateChanged(); return; } - if (!transaction.functionId.isEmpty()) - encoder.encode(f); - for (QVariableDeclaration const* p: f->parametersList()) - { - QSolidityType const* type = p->type(); - QVariant value = transaction.parameterValues.value(p->name()); - if (type->type().type == SolidityType::Type::Address) - { - std::pair ctrParamInstance = resolvePair(value.toString()); - value = QVariant(resolveToken(ctrParamInstance, deployedContracts)); - } - encoder.encode(value, type->type()); - } - - if (transaction.functionId.isEmpty() || transaction.functionId == ctrInstance.first) - { - bytes param = encoder.encodedData(); - contractCode.insert(contractCode.end(), param.begin(), param.end()); - Address newAddress = deployContract(contractCode, transaction); - deployedContracts.push_back(newAddress); - std::pair contractToken = retrieveToken(transaction.contractId, deployedContracts); - m_contractAddresses[contractToken] = newAddress; - m_contractNames[newAddress] = contractToken.first; - contractAddressesChanged(); - gasCostsChanged(); - } - else - { - auto contractAddressIter = m_contractAddresses.find(ctrInstance); - if (contractAddressIter == m_contractAddresses.end()) - { - emit runFailed("Contract '" + transaction.contractId + tr(" not deployed.") + "' " + tr(" Cannot call ") + transaction.functionId); - m_running = false; - emit runStateChanged(); - return; - } - callAddress(contractAddressIter->second, encoder.encodedData(), transaction); - } - m_gasCosts.append(m_client->lastExecution().gasUsed); + callAddress(contractAddressIter->second, encoder.encodedData(), transaction); } + m_gasCosts.append(m_client->lastExecution().gasUsed); onNewTransaction(); } m_running = false; @@ -697,14 +669,7 @@ void ClientModel::onNewTransaction() if (creation) { //contract creation - auto const stdContractName = m_stdContractNames.find(tr.contractAddress); - if (stdContractName != m_stdContractNames.end()) - { - function = stdContractName->second; - contract = function; - } - else - function = QObject::tr("Constructor"); + function = QObject::tr("Constructor"); address = QObject::tr("(Create contract)"); } else diff --git a/mix/qml.qrc b/mix/qml.qrc index 6cbc97a78..c47a7254f 100644 --- a/mix/qml.qrc +++ b/mix/qml.qrc @@ -8,7 +8,6 @@ qml/CodeEditorStyle.qml qml/CodeEditorView.qml qml/CommonSeparator.qml - qml/ContractLibrary.qml qml/DebugBasicInfo.qml qml/DebugInfoList.qml qml/Debugger.qml diff --git a/mix/qml/ContractLibrary.qml b/mix/qml/ContractLibrary.qml deleted file mode 100644 index 4f3afafc6..000000000 --- a/mix/qml/ContractLibrary.qml +++ /dev/null @@ -1,27 +0,0 @@ -import QtQuick 2.2 - -Item { - id: contractLibrary - property alias model: contractListModel; - - Connections { - target: mainApplication - onLoaded: { - - //TODO: load a list, dependencies, ets, from external files - contractListModel.append({ - name: "Config", - url: "qrc:///stdc/std.sol", - }); - contractListModel.append({ - name: "NameReg", - url: "qrc:///stdc/std.sol", - }); - } - } - - ListModel { - id: contractListModel - } -} - diff --git a/mix/qml/StateListModel.qml b/mix/qml/StateListModel.qml index b4d9b6bc6..f21c93199 100644 --- a/mix/qml/StateListModel.qml +++ b/mix/qml/StateListModel.qml @@ -22,7 +22,7 @@ Item { s.contracts = []; return { title: s.title, - transactions: s.transactions.map(fromPlainTransactionItem), + transactions: s.transactions.filter(function(t) { return !t.stdContract; }).map(fromPlainTransactionItem), //support old projects by filtering std contracts accounts: s.accounts.map(fromPlainAccountItem), contracts: s.contracts.map(fromPlainAccountItem), miner: s.miner @@ -54,7 +54,6 @@ Item { gas: QEtherHelper.createBigInt(t.gas.value), gasPrice: QEtherHelper.createEther(t.gasPrice.value, t.gasPrice.unit), gasAuto: t.gasAuto, - stdContract: t.stdContract ? true : false, parameters: {}, sender: t.sender, isContractCreation: t.isContractCreation, @@ -122,7 +121,6 @@ Item { gas: { value: t.gas.value() }, gasAuto: t.gasAuto, gasPrice: { value: t.gasPrice.value, unit: t.gasPrice.unit }, - stdContract: t.stdContract, sender: t.sender, parameters: {}, isContractCreation: t.isContractCreation, @@ -189,10 +187,6 @@ Item { } } - ContractLibrary { - id: contractLibrary; - } - ListModel { id: stateListModel property int defaultStateIndex: 0 @@ -226,18 +220,6 @@ Item { item.accounts.push(account); item.miner = account; - //add all stdc contracts - for (var i = 0; i < contractLibrary.model.count; i++) { - var contractTransaction = defaultTransactionItem(); - var contractItem = contractLibrary.model.get(i); - contractTransaction.url = contractItem.url; - contractTransaction.contractId = contractItem.name; - contractTransaction.functionId = contractItem.name; - contractTransaction.stdContract = true; - contractTransaction.sender = item.accounts[0].secret; // default account is used to deploy std contract. - item.transactions.push(contractTransaction); - }; - //add constructors, //TODO: order by dependencies for(var c in codeModel.contracts) { var ctorTr = defaultTransactionItem(); @@ -273,17 +255,12 @@ Item { } function addNewContracts() { - //add new contracts for all states + //add new contracts to empty states var changed = false; for (var c in codeModel.contracts) { for (var s = 0; s < stateListModel.count; s++) { var state = stateList[s]; - for (var t = 0; t < state.transactions.length; t++) { - var transaction = state.transactions[t]; - if (transaction.functionId === c && transaction.contractId === c) - break; - } - if (t === state.transactions.length) { + if (state.transactions.length === 0) { //append this contract var ctorTr = defaultTransactionItem(); ctorTr.functionId = c; diff --git a/mix/qml/TransactionDialog.qml b/mix/qml/TransactionDialog.qml index fe4bfc82e..1437c2562 100644 --- a/mix/qml/TransactionDialog.qml +++ b/mix/qml/TransactionDialog.qml @@ -210,6 +210,8 @@ Dialog { } item.isContractCreation = trType.checked; + if (item.isContractCreation) + item.functionId = item.contractId; item.isFunctionCall = item.functionId !== " - "; if (!item.isContractCreation) diff --git a/mix/qml/html/cm/codemirror.css b/mix/qml/html/cm/codemirror.css index 625baa942..c25a3ddad 100644 --- a/mix/qml/html/cm/codemirror.css +++ b/mix/qml/html/cm/codemirror.css @@ -8,6 +8,10 @@ font-size:12px } +.CodeMirror-search-field { + height:200%; +} + /* BREAKPOINTS */ .breakpoints {width: .8em;} .breakpoint { color: #822; } diff --git a/mix/qml/html/cm/solidityToken.js b/mix/qml/html/cm/solidityToken.js index d8e588a10..1c12278e1 100644 --- a/mix/qml/html/cm/solidityToken.js +++ b/mix/qml/html/cm/solidityToken.js @@ -5,7 +5,7 @@ function solCurrency() function solKeywords() { - return { "break": true, "case": true, "constant": true, "continue": true, "contract": true, "default": true, "do": true, "else": true, "event": true, "external": true, "is": true, "indexed": true, "for": true, "function": true, "if": true, "import": true, "mapping": true, "modifier": true, "new": true, "public": true, "private": true, "internal": true, "return": true, "returns": true, "struct": true, "switch": true, "var": true, "while": true, "enum": true }; + return { "break": true, "case": true, "constant": true, "continue": true, "contract": true, "default": true, "delete": true, "do": true, "else": true, "event": true, "external": true, "is": true, "indexed": true, "for": true, "function": true, "if": true, "import": true, "mapping": true, "modifier": true, "new": true, "public": true, "private": true, "internal": true, "return": true, "returns": true, "struct": true, "switch": true, "var": true, "while": true, "enum": true }; } function solStdContract() From 66c2e4b4598a3160f95d9dc09a4b14faa2a2bf4a Mon Sep 17 00:00:00 2001 From: subtly Date: Mon, 18 May 2015 15:56:45 +0200 Subject: [PATCH 05/13] normalize path for osx --- libethash/io_posix.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libethash/io_posix.c b/libethash/io_posix.c index b030748a9..1fe82973f 100644 --- a/libethash/io_posix.c +++ b/libethash/io_posix.c @@ -90,20 +90,16 @@ bool ethash_file_size(FILE* f, size_t* ret_size) bool ethash_get_default_dirname(char* strbuf, size_t buffsize) { -#if defined(__APPLE__) - static const char dir_suffix[] = "Ethash/"; + static const char dir_suffix[] = ".ethash/"; strbuf[0] = '\0'; char* home_dir = getenv("HOME"); +#if defined(__APPLE__) if (!home_dir || strlen(home_dir) == 0) { struct passwd* pwd = getpwuid(getuid()); if (pwd) home_dir = pwd->pw_dir; } -#else - static const char dir_suffix[] = ".ethash/"; - strbuf[0] = '\0'; - char* home_dir = getenv("HOME"); #endif size_t len = strlen(home_dir); From 6879c04393658f382ecd441947831c3a08e0830d Mon Sep 17 00:00:00 2001 From: subtly Date: Mon, 18 May 2015 16:54:32 +0200 Subject: [PATCH 06/13] Update paths so macos is consistent with linux and windows isn't using wchar. --- io_posix.c | 13 +++++++++++++ io_win32.c | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/io_posix.c b/io_posix.c index 7f03d5482..1fe82973f 100644 --- a/io_posix.c +++ b/io_posix.c @@ -26,6 +26,10 @@ #include #include #include +#if defined(__APPLE__) +#include +#include +#endif FILE* ethash_fopen(char const* file_name, char const* mode) { @@ -89,6 +93,15 @@ bool ethash_get_default_dirname(char* strbuf, size_t buffsize) static const char dir_suffix[] = ".ethash/"; strbuf[0] = '\0'; char* home_dir = getenv("HOME"); +#if defined(__APPLE__) + if (!home_dir || strlen(home_dir) == 0) + { + struct passwd* pwd = getpwuid(getuid()); + if (pwd) + home_dir = pwd->pw_dir; + } +#endif + size_t len = strlen(home_dir); if (!ethash_strncat(strbuf, buffsize, home_dir, len)) { return false; diff --git a/io_win32.c b/io_win32.c index 2e6c8deb8..34f1aaa77 100644 --- a/io_win32.c +++ b/io_win32.c @@ -87,9 +87,9 @@ bool ethash_file_size(FILE* f, size_t* ret_size) bool ethash_get_default_dirname(char* strbuf, size_t buffsize) { - static const char dir_suffix[] = "Appdata\\Ethash\\"; + static const char dir_suffix[] = "Ethash\\"; strbuf[0] = '\0'; - if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, (WCHAR*)strbuf))) { + if (!SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, (CHAR*)strbuf))) { return false; } if (!ethash_strncat(strbuf, buffsize, "\\", 1)) { From 9fcbacc95cea036fc27f53596d49b8bae35b3f48 Mon Sep 17 00:00:00 2001 From: subtly Date: Mon, 18 May 2015 17:35:34 +0200 Subject: [PATCH 07/13] remove apple check, as getpwuid is *nx-safe --- io_posix.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/io_posix.c b/io_posix.c index 1fe82973f..c9a17d845 100644 --- a/io_posix.c +++ b/io_posix.c @@ -26,10 +26,8 @@ #include #include #include -#if defined(__APPLE__) #include #include -#endif FILE* ethash_fopen(char const* file_name, char const* mode) { @@ -93,14 +91,12 @@ bool ethash_get_default_dirname(char* strbuf, size_t buffsize) static const char dir_suffix[] = ".ethash/"; strbuf[0] = '\0'; char* home_dir = getenv("HOME"); -#if defined(__APPLE__) if (!home_dir || strlen(home_dir) == 0) { struct passwd* pwd = getpwuid(getuid()); if (pwd) home_dir = pwd->pw_dir; } -#endif size_t len = strlen(home_dir); if (!ethash_strncat(strbuf, buffsize, home_dir, len)) { From 67e1d52f2ce884c870d89b436e0b9fb72b04730b Mon Sep 17 00:00:00 2001 From: subtly Date: Mon, 18 May 2015 18:09:41 +0200 Subject: [PATCH 08/13] Import changes into MinerAux and retain pointer to dag. --- ethminer/MinerAux.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ethminer/MinerAux.h b/ethminer/MinerAux.h index 31e66d94a..0441bc412 100644 --- a/ethminer/MinerAux.h +++ b/ethminer/MinerAux.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -398,6 +399,7 @@ private: f.startGPU(); ProofOfWork::WorkPackage current; + EthashAux::FullType dag; while (true) try { @@ -416,10 +418,13 @@ private: cnote << "Getting work package..."; Json::Value v = rpc.eth_getWork(); h256 hh(v[0].asString()); + h256 newSeedHash(v[1].asString()); + if (!(dag = EthashAux::full(newSeedHash, true))) + BOOST_THROW_EXCEPTION(DAGCreationFailure()); if (hh != current.headerHash) { current.headerHash = hh; - current.seedHash = h256(v[1].asString()); + current.seedHash = newSeedHash; current.boundary = h256(fromHex(v[2].asString()), h256::AlignRight); cnote << "Got work package:"; cnote << " Header-hash:" << current.headerHash.hex(); From 0768814d7332eb695438e19efb15b01ae3264754 Mon Sep 17 00:00:00 2001 From: subtly Date: Mon, 18 May 2015 18:10:59 +0200 Subject: [PATCH 09/13] reverse commit for ethash --- libethash/io_posix.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/libethash/io_posix.c b/libethash/io_posix.c index 1fe82973f..80046252d 100644 --- a/libethash/io_posix.c +++ b/libethash/io_posix.c @@ -26,10 +26,6 @@ #include #include #include -#if defined(__APPLE__) -#include -#include -#endif FILE* ethash_fopen(char const* file_name, char const* mode) { @@ -93,14 +89,6 @@ bool ethash_get_default_dirname(char* strbuf, size_t buffsize) static const char dir_suffix[] = ".ethash/"; strbuf[0] = '\0'; char* home_dir = getenv("HOME"); -#if defined(__APPLE__) - if (!home_dir || strlen(home_dir) == 0) - { - struct passwd* pwd = getpwuid(getuid()); - if (pwd) - home_dir = pwd->pw_dir; - } -#endif size_t len = strlen(home_dir); if (!ethash_strncat(strbuf, buffsize, home_dir, len)) { From 07b0ff85ffcc045991a9c97cf43640a9dbf95271 Mon Sep 17 00:00:00 2001 From: subtly Date: Mon, 18 May 2015 18:11:58 +0200 Subject: [PATCH 10/13] reverse commit for ethash --- libethash/io_win32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libethash/io_win32.c b/libethash/io_win32.c index 34f1aaa77..e6e332b9f 100644 --- a/libethash/io_win32.c +++ b/libethash/io_win32.c @@ -87,9 +87,9 @@ bool ethash_file_size(FILE* f, size_t* ret_size) bool ethash_get_default_dirname(char* strbuf, size_t buffsize) { - static const char dir_suffix[] = "Ethash\\"; + static const char dir_suffix[] = "AppData\\Ethash\\"; strbuf[0] = '\0'; - if (!SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, (CHAR*)strbuf))) { + if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, (WCHAR*)strbuf))) { return false; } if (!ethash_strncat(strbuf, buffsize, "\\", 1)) { From 3bd7b5241c7b940102c939476a713971aaea2687 Mon Sep 17 00:00:00 2001 From: subtly Date: Mon, 18 May 2015 18:12:55 +0200 Subject: [PATCH 11/13] reverse ethash changes --- libethash/io_posix.c | 2 +- libethash/io_win32.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libethash/io_posix.c b/libethash/io_posix.c index 80046252d..1dea66ed1 100644 --- a/libethash/io_posix.c +++ b/libethash/io_posix.c @@ -89,7 +89,7 @@ bool ethash_get_default_dirname(char* strbuf, size_t buffsize) static const char dir_suffix[] = ".ethash/"; strbuf[0] = '\0'; char* home_dir = getenv("HOME"); - + size_t len = strlen(home_dir); if (!ethash_strncat(strbuf, buffsize, home_dir, len)) { return false; diff --git a/libethash/io_win32.c b/libethash/io_win32.c index e6e332b9f..2e6c8deb8 100644 --- a/libethash/io_win32.c +++ b/libethash/io_win32.c @@ -87,7 +87,7 @@ bool ethash_file_size(FILE* f, size_t* ret_size) bool ethash_get_default_dirname(char* strbuf, size_t buffsize) { - static const char dir_suffix[] = "AppData\\Ethash\\"; + static const char dir_suffix[] = "Appdata\\Ethash\\"; strbuf[0] = '\0'; if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, (WCHAR*)strbuf))) { return false; From 3b233f46e0d37323d2efdb0bb0437d2b1d603b8d Mon Sep 17 00:00:00 2001 From: subtly Date: Mon, 18 May 2015 18:13:52 +0200 Subject: [PATCH 12/13] reverse ethash changes --- libethash/io_posix.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libethash/io_posix.c b/libethash/io_posix.c index 1dea66ed1..7f03d5482 100644 --- a/libethash/io_posix.c +++ b/libethash/io_posix.c @@ -89,7 +89,6 @@ bool ethash_get_default_dirname(char* strbuf, size_t buffsize) static const char dir_suffix[] = ".ethash/"; strbuf[0] = '\0'; char* home_dir = getenv("HOME"); - size_t len = strlen(home_dir); if (!ethash_strncat(strbuf, buffsize, home_dir, len)) { return false; From f55975b5dcffd0ebda49fe63eafdc450df486d40 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Tue, 19 May 2015 09:12:15 +0200 Subject: [PATCH 13/13] cleaner output --- libethereum/Client.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index 6d5e39e39..30eb12352 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -606,9 +606,10 @@ bool Client::remoteActive() const void Client::onPostStateChanged() { - cnote << "Post state changed: Restarting mining..."; + cnote << "Post state changed"; if (isMining() || remoteActive()) { + cnote << "Restarting mining..."; DEV_WRITE_GUARDED(x_working) m_working.commitToMine(m_bc); DEV_READ_GUARDED(x_working)