Skip to content

Commit

Permalink
2.2 branch (#12)
Browse files Browse the repository at this point in the history
* Commit #11 Improve the miner to have a master/slave mode

* Fix invalid effective hashrate output

* Fix invalid address for nonce

* Added effective hashrate output for master instance

Clean up code
Raised version

* Fixed miner not resuming on connection restore

* Fix invalid nonce on very low difficulty CPU mining

* Add error handling for failed master instance initialization

* Add Windows 7 SP1 target in preprocessor

* Added master/slave launch scripts, update Readme

* Add submit nonce count output in slave instance

* Fix ArgumentNullException if not able to retreive GPU name

* Update launch scripts

* Add slave behavior for Solo/Pool mining at master

Solo mining should submit only 1 valid nonce per challange

* Clean up code

* Add slave URL printing upon receive solution from slave miner

* Fix incorrect difficulty comparison

* Update guides
  • Loading branch information
lwYeo authored Dec 3, 2018
1 parent 1fc0010 commit f24d60e
Show file tree
Hide file tree
Showing 49 changed files with 2,666 additions and 1,317 deletions.
2 changes: 2 additions & 0 deletions CPUSoliditySHA3Solver/CPUSoliditySHA3Solver.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -80,6 +81,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
Expand Down
12 changes: 6 additions & 6 deletions CPUSoliditySHA3Solver/cpuSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace CPUSolver
std::memcpy(&currentSolution, deviceInstance->SolutionTemplate, UINT256_LENGTH);

uint64_t const endWorkPosition = processor->WorkPosition + processor->WorkSize;
uint32_t const maxSolutionCount = deviceInstance->MaxSolutionCount;
uint32_t const maxSolutionCount = processor->MaxSolutionCount;

for (auto currentWorkPosition = processor->WorkPosition; currentWorkPosition < endWorkPosition; ++currentWorkPosition)
{
Expand All @@ -99,10 +99,10 @@ namespace CPUSolver

if (IslessThan(digest, currentTarget))
{
if (deviceInstance->SolutionCount < maxSolutionCount)
if (processor->SolutionCount < maxSolutionCount)
{
deviceInstance->Solutions[deviceInstance->SolutionCount] = currentWorkPosition;
deviceInstance->SolutionCount++;
processor->Solutions[processor->SolutionCount] = currentWorkPosition;
processor->SolutionCount++;
}
}
}
Expand All @@ -112,15 +112,15 @@ namespace CPUSolver
{
uint64_t const endWorkPosition = processor->WorkPosition + processor->WorkSize;
uint64_t const currentHigh64Target = *deviceInstance->High64Target;
uint32_t const maxSolutionCount = deviceInstance->MaxSolutionCount;
uint32_t const maxSolutionCount = processor->MaxSolutionCount;

uint64_t currentMidState[SPONGE_LENGTH / UINT64_LENGTH];
std::memcpy(&currentMidState, deviceInstance->MidState, SPONGE_LENGTH);

for (auto currentWorkPosition = processor->WorkPosition; currentWorkPosition < endWorkPosition; ++currentWorkPosition)
{
sha3_midstate(currentMidState, currentHigh64Target, currentWorkPosition, maxSolutionCount,
&deviceInstance->SolutionCount, deviceInstance->Solutions);
&processor->SolutionCount, processor->Solutions);
}
}

Expand Down
8 changes: 4 additions & 4 deletions CPUSoliditySHA3Solver/instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ struct Processor
int Affinity;
uint64_t WorkSize;
uint64_t WorkPosition;

uint32_t MaxSolutionCount;
uint32_t SolutionCount;
uint64_t *Solutions;
};

struct Instance
Expand All @@ -36,8 +40,4 @@ struct Instance

uint8_t *Target;
uint64_t *High64Target;

uint32_t MaxSolutionCount;
uint32_t SolutionCount;
uint64_t *Solutions;
};
Loading

0 comments on commit f24d60e

Please sign in to comment.